|
@@ 508-533 (lines=26) @@
|
| 505 |
|
$this->assertSame($destination, $request->attributes->get('semanticPathinfo')); |
| 506 |
|
} |
| 507 |
|
|
| 508 |
|
public function testMatchRequestResourceWithRedirect() |
| 509 |
|
{ |
| 510 |
|
$pathInfo = '/hello_content/hello_search'; |
| 511 |
|
$destination = '/content/search'; |
| 512 |
|
$urlAlias = new URLAlias( |
| 513 |
|
array( |
| 514 |
|
'destination' => $destination, |
| 515 |
|
'path' => $pathInfo, |
| 516 |
|
'type' => UrlAlias::RESOURCE, |
| 517 |
|
'forward' => true, |
| 518 |
|
) |
| 519 |
|
); |
| 520 |
|
$request = $this->getRequestByPathInfo($pathInfo); |
| 521 |
|
$this->urlAliasService |
| 522 |
|
->expects($this->once()) |
| 523 |
|
->method('lookup') |
| 524 |
|
->with($pathInfo) |
| 525 |
|
->will($this->returnValue($urlAlias)); |
| 526 |
|
|
| 527 |
|
$expected = array( |
| 528 |
|
'_route' => UrlAliasRouter::URL_ALIAS_ROUTE_NAME, |
| 529 |
|
); |
| 530 |
|
$this->assertEquals($expected, $this->router->matchRequest($request)); |
| 531 |
|
$this->assertTrue($request->attributes->get('needsRedirect')); |
| 532 |
|
$this->assertSame($destination, $request->attributes->get('semanticPathinfo')); |
| 533 |
|
} |
| 534 |
|
|
| 535 |
|
public function testMatchRequestResourceWithCaseRedirect() |
| 536 |
|
{ |
|
@@ 572-598 (lines=27) @@
|
| 569 |
|
* Tests that forwarding custom alias will redirect to the resource destination rather than |
| 570 |
|
* to the case-corrected alias. |
| 571 |
|
*/ |
| 572 |
|
public function testMatchRequestResourceCaseIncorrectWithForwardRedirect() |
| 573 |
|
{ |
| 574 |
|
$pathInfo = '/heLLo_contEnt/hEllo_SEarch'; |
| 575 |
|
$urlAliasPath = '/hello_content/hello_search'; |
| 576 |
|
$destination = '/content/search'; |
| 577 |
|
$urlAlias = new URLAlias( |
| 578 |
|
array( |
| 579 |
|
'destination' => $destination, |
| 580 |
|
'path' => $urlAliasPath, |
| 581 |
|
'type' => UrlAlias::RESOURCE, |
| 582 |
|
'forward' => true, |
| 583 |
|
) |
| 584 |
|
); |
| 585 |
|
$request = $this->getRequestByPathInfo($pathInfo); |
| 586 |
|
$this->urlAliasService |
| 587 |
|
->expects($this->once()) |
| 588 |
|
->method('lookup') |
| 589 |
|
->with($pathInfo) |
| 590 |
|
->will($this->returnValue($urlAlias)); |
| 591 |
|
|
| 592 |
|
$expected = array( |
| 593 |
|
'_route' => UrlAliasRouter::URL_ALIAS_ROUTE_NAME, |
| 594 |
|
); |
| 595 |
|
$this->assertEquals($expected, $this->router->matchRequest($request)); |
| 596 |
|
$this->assertTrue($request->attributes->get('needsRedirect')); |
| 597 |
|
$this->assertSame($destination, $request->attributes->get('semanticPathinfo')); |
| 598 |
|
} |
| 599 |
|
|
| 600 |
|
public function testMatchRequestVirtual() |
| 601 |
|
{ |