| @@ 221-267 (lines=47) @@ | ||
| 218 | $this->assertNull($compoundMatcher->reverseMatch($siteAccessName)); |
|
| 219 | } |
|
| 220 | ||
| 221 | public function testReverseMatchFail() |
|
| 222 | { |
|
| 223 | $request = $this->createMock(SimplifiedRequest::class); |
|
| 224 | $siteAccessName = 'fr_eng'; |
|
| 225 | $mapUriConfig = array('eng' => true); |
|
| 226 | $mapHostConfig = array('fr.ezpublish.dev' => true); |
|
| 227 | $compoundMatcher = new LogicalAnd( |
|
| 228 | array( |
|
| 229 | array( |
|
| 230 | 'matchers' => array( |
|
| 231 | 'Map\URI' => $mapUriConfig, |
|
| 232 | 'Map\Host' => $mapHostConfig, |
|
| 233 | ), |
|
| 234 | 'match' => $siteAccessName, |
|
| 235 | ), |
|
| 236 | ) |
|
| 237 | ); |
|
| 238 | $compoundMatcher->setRequest($request); |
|
| 239 | ||
| 240 | $matcher1 = $this->createMock(VersatileMatcher::class); |
|
| 241 | $matcher2 = $this->createMock(VersatileMatcher::class); |
|
| 242 | $this->matcherBuilder |
|
| 243 | ->expects($this->exactly(2)) |
|
| 244 | ->method('buildMatcher') |
|
| 245 | ->will( |
|
| 246 | $this->returnValueMap( |
|
| 247 | array( |
|
| 248 | array('Map\URI', $mapUriConfig, $request, $matcher1), |
|
| 249 | array('Map\Host', $mapHostConfig, $request, $matcher2), |
|
| 250 | ) |
|
| 251 | ) |
|
| 252 | ); |
|
| 253 | ||
| 254 | $matcher1 |
|
| 255 | ->expects($this->once()) |
|
| 256 | ->method('reverseMatch') |
|
| 257 | ->with($siteAccessName) |
|
| 258 | ->will($this->returnValue($this->createMock(VersatileMatcher::class))); |
|
| 259 | $matcher2 |
|
| 260 | ->expects($this->once()) |
|
| 261 | ->method('reverseMatch') |
|
| 262 | ->with($siteAccessName) |
|
| 263 | ->will($this->returnValue(null)); |
|
| 264 | ||
| 265 | $compoundMatcher->setMatcherBuilder($this->matcherBuilder); |
|
| 266 | $this->assertNull($compoundMatcher->reverseMatch($siteAccessName)); |
|
| 267 | } |
|
| 268 | ||
| 269 | public function testReverseMatch() |
|
| 270 | { |
|
| @@ 179-225 (lines=47) @@ | ||
| 176 | $this->assertNull($compoundMatcher->reverseMatch($siteAccessName)); |
|
| 177 | } |
|
| 178 | ||
| 179 | public function testReverseMatchFail() |
|
| 180 | { |
|
| 181 | $request = $this->createMock(SimplifiedRequest::class); |
|
| 182 | $siteAccessName = 'fr_eng'; |
|
| 183 | $mapUriConfig = array('eng' => true); |
|
| 184 | $mapHostConfig = array('fr.ezpublish.dev' => true); |
|
| 185 | $compoundMatcher = new LogicalOr( |
|
| 186 | array( |
|
| 187 | array( |
|
| 188 | 'matchers' => array( |
|
| 189 | 'Map\URI' => $mapUriConfig, |
|
| 190 | 'Map\Host' => $mapHostConfig, |
|
| 191 | ), |
|
| 192 | 'match' => $siteAccessName, |
|
| 193 | ), |
|
| 194 | ) |
|
| 195 | ); |
|
| 196 | $compoundMatcher->setRequest($request); |
|
| 197 | ||
| 198 | $matcher1 = $this->createMock(VersatileMatcher::class); |
|
| 199 | $matcher2 = $this->createMock(VersatileMatcher::class); |
|
| 200 | $this->matcherBuilder |
|
| 201 | ->expects($this->exactly(2)) |
|
| 202 | ->method('buildMatcher') |
|
| 203 | ->will( |
|
| 204 | $this->returnValueMap( |
|
| 205 | array( |
|
| 206 | array('Map\URI', $mapUriConfig, $request, $matcher1), |
|
| 207 | array('Map\Host', $mapHostConfig, $request, $matcher2), |
|
| 208 | ) |
|
| 209 | ) |
|
| 210 | ); |
|
| 211 | ||
| 212 | $matcher1 |
|
| 213 | ->expects($this->once()) |
|
| 214 | ->method('reverseMatch') |
|
| 215 | ->with($siteAccessName) |
|
| 216 | ->will($this->returnValue(null)); |
|
| 217 | $matcher2 |
|
| 218 | ->expects($this->once()) |
|
| 219 | ->method('reverseMatch') |
|
| 220 | ->with($siteAccessName) |
|
| 221 | ->will($this->returnValue(null)); |
|
| 222 | ||
| 223 | $compoundMatcher->setMatcherBuilder($this->matcherBuilder); |
|
| 224 | $this->assertNull($compoundMatcher->reverseMatch($siteAccessName)); |
|
| 225 | } |
|
| 226 | ||
| 227 | public function testReverseMatch1() |
|
| 228 | { |
|