| @@ 198-238 (lines=41) @@ | ||
| 195 | $this->assertEquals($expected, $this->router->matchRequest($request)); |
|
| 196 | } |
|
| 197 | ||
| 198 | public function testMatchRequestLocationWithCaseRedirect() |
|
| 199 | { |
|
| 200 | $pathInfo = '/Foo/bAR'; |
|
| 201 | $urlAliasPath = '/foo/bar'; |
|
| 202 | $destinationId = 123; |
|
| 203 | $urlAlias = new URLAlias( |
|
| 204 | [ |
|
| 205 | 'path' => $urlAliasPath, |
|
| 206 | 'type' => UrlAlias::LOCATION, |
|
| 207 | 'destination' => $destinationId, |
|
| 208 | 'isHistory' => false, |
|
| 209 | ] |
|
| 210 | ); |
|
| 211 | $request = $this->getRequestByPathInfo($pathInfo); |
|
| 212 | $this->urlALiasGenerator |
|
| 213 | ->expects($this->once()) |
|
| 214 | ->method('isUriPrefixExcluded') |
|
| 215 | ->with($pathInfo) |
|
| 216 | ->will($this->returnValue(false)); |
|
| 217 | $this->urlAliasService |
|
| 218 | ->expects($this->once()) |
|
| 219 | ->method('lookup') |
|
| 220 | ->with($pathInfo) |
|
| 221 | ->will($this->returnValue($urlAlias)); |
|
| 222 | $this->urlALiasGenerator |
|
| 223 | ->expects($this->once()) |
|
| 224 | ->method('loadLocation') |
|
| 225 | ->will($this->returnValue(new Location(['contentInfo' => new ContentInfo(['id' => 456])]))); |
|
| 226 | ||
| 227 | $expected = [ |
|
| 228 | '_route' => UrlAliasRouter::URL_ALIAS_ROUTE_NAME, |
|
| 229 | '_controller' => UrlAliasRouter::VIEW_ACTION, |
|
| 230 | 'locationId' => $destinationId, |
|
| 231 | 'contentId' => 456, |
|
| 232 | 'viewType' => ViewManager::VIEW_TYPE_FULL, |
|
| 233 | 'layout' => true, |
|
| 234 | 'needsRedirect' => true, |
|
| 235 | 'semanticPathinfo' => $urlAliasPath, |
|
| 236 | ]; |
|
| 237 | $this->assertEquals($expected, $this->router->matchRequest($request)); |
|
| 238 | } |
|
| 239 | ||
| 240 | public function testMatchRequestLocationWrongCaseUriPrefixExcluded() |
|
| 241 | { |
|
| @@ 240-280 (lines=41) @@ | ||
| 237 | $this->assertEquals($expected, $this->router->matchRequest($request)); |
|
| 238 | } |
|
| 239 | ||
| 240 | public function testMatchRequestLocationWrongCaseUriPrefixExcluded() |
|
| 241 | { |
|
| 242 | $pathInfo = '/Foo/bAR'; |
|
| 243 | $urlAliasPath = '/foo/bar'; |
|
| 244 | $destinationId = 123; |
|
| 245 | $urlAlias = new URLAlias( |
|
| 246 | [ |
|
| 247 | 'path' => $urlAliasPath, |
|
| 248 | 'type' => UrlAlias::LOCATION, |
|
| 249 | 'destination' => $destinationId, |
|
| 250 | 'isHistory' => false, |
|
| 251 | ] |
|
| 252 | ); |
|
| 253 | $request = $this->getRequestByPathInfo($pathInfo); |
|
| 254 | $this->urlALiasGenerator |
|
| 255 | ->expects($this->once()) |
|
| 256 | ->method('isUriPrefixExcluded') |
|
| 257 | ->with($pathInfo) |
|
| 258 | ->will($this->returnValue(true)); |
|
| 259 | $this->urlAliasService |
|
| 260 | ->expects($this->once()) |
|
| 261 | ->method('lookup') |
|
| 262 | ->with($pathInfo) |
|
| 263 | ->will($this->returnValue($urlAlias)); |
|
| 264 | $this->urlALiasGenerator |
|
| 265 | ->expects($this->once()) |
|
| 266 | ->method('loadLocation') |
|
| 267 | ->will($this->returnValue(new Location(['contentInfo' => new ContentInfo(['id' => 456])]))); |
|
| 268 | ||
| 269 | $expected = [ |
|
| 270 | '_route' => UrlAliasRouter::URL_ALIAS_ROUTE_NAME, |
|
| 271 | '_controller' => UrlAliasRouter::VIEW_ACTION, |
|
| 272 | 'contentId' => 456, |
|
| 273 | 'locationId' => $destinationId, |
|
| 274 | 'viewType' => ViewManager::VIEW_TYPE_FULL, |
|
| 275 | 'layout' => true, |
|
| 276 | 'needsRedirect' => true, |
|
| 277 | 'semanticPathinfo' => $urlAliasPath, |
|
| 278 | ]; |
|
| 279 | $this->assertEquals($expected, $this->router->matchRequest($request)); |
|
| 280 | } |
|
| 281 | ||
| 282 | public function testMatchRequestLocationCorrectCaseUriPrefixExcluded() |
|
| 283 | { |
|