|
@@ 75-89 (lines=15) @@
|
| 72 |
|
* @dataProvider configProvider |
| 73 |
|
* @param array $config |
| 74 |
|
*/ |
| 75 |
|
public function testTrailingSlashRedirect(array $config) |
| 76 |
|
{ |
| 77 |
|
$request = $this->getFooRequest(); |
| 78 |
|
$event = $this->getGetResponseForExceptionEvent($request); |
| 79 |
|
|
| 80 |
|
$listener = $this->getKernelEventListener($config); |
| 81 |
|
|
| 82 |
|
$listener->onKernelException($event); |
| 83 |
|
|
| 84 |
|
/** @var RedirectResponse $response */ |
| 85 |
|
$response = $event->getResponse(); |
| 86 |
|
|
| 87 |
|
$this->assertTrue($response instanceof RedirectResponse); |
| 88 |
|
$this->assertEquals('https://example.org/foo', $response->getTargetUrl()); |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
/** |
| 92 |
|
* @dataProvider configProvider |
|
@@ 150-164 (lines=15) @@
|
| 147 |
|
* @dataProvider configProvider |
| 148 |
|
* @param array $config |
| 149 |
|
*/ |
| 150 |
|
public function testRouteWithUrlParametersAndTrailingSlashRedirectsToCorrectRoute(array $config) |
| 151 |
|
{ |
| 152 |
|
$request = Request::create('https://example.org/foo/bar/'); |
| 153 |
|
$event = $this->getGetResponseForExceptionEvent($request); |
| 154 |
|
|
| 155 |
|
$listener = $this->getKernelEventListener($config); |
| 156 |
|
|
| 157 |
|
$listener->onKernelException($event); |
| 158 |
|
|
| 159 |
|
/** @var RedirectResponse $response */ |
| 160 |
|
$response = $event->getResponse(); |
| 161 |
|
|
| 162 |
|
$this->assertInstanceOf(RedirectResponse::class, $response); |
| 163 |
|
$this->assertEquals('https://example.org/foo/bar', $response->getTargetUrl()); |
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
/** |
| 167 |
|
* @param Request $request |