diff --git a/tests/Bridge/Symfony/Routing/RouterTest.php b/tests/Bridge/Symfony/Routing/RouterTest.php index 69318e33617..52dc0d2e613 100644 --- a/tests/Bridge/Symfony/Routing/RouterTest.php +++ b/tests/Bridge/Symfony/Routing/RouterTest.php @@ -96,7 +96,7 @@ public function testMatch() $this->assertEquals(['bar'], $router->match('/app_dev.php/foo')); } - public function testWithinvalidContext() + public function testMatchWithInvalidContext() { $this->expectException(RoutingExceptionInterface::class); $this->expectExceptionMessage('Invalid request context.'); @@ -108,4 +108,32 @@ public function testWithinvalidContext() $router = new Router($mockedRouter->reveal()); $router->match('28-01-2018 10:10'); } + + public function testMatchDuplicatedBaseUrl() + { + $context = new RequestContext('/app', 'GET', 'localhost', 'https'); + + $mockedRouter = $this->prophesize(RouterInterface::class); + $mockedRouter->getContext()->willReturn($context); + $mockedRouter->setContext(Argument::type(RequestContext::class))->willReturn(); + $mockedRouter->match('/api/app_crm/resource')->willReturn(['bar']); + + $router = new Router($mockedRouter->reveal()); + + $this->assertEquals(['bar'], $router->match('/app/api/app_crm/resource')); + } + + public function testMatchEmptyBaseUrl() + { + $context = new RequestContext('', 'GET', 'localhost', 'https'); + + $mockedRouter = $this->prophesize(RouterInterface::class); + $mockedRouter->getContext()->willReturn($context); + $mockedRouter->setContext(Argument::type(RequestContext::class))->willReturn(); + $mockedRouter->match('/foo')->willReturn(['bar']); + + $router = new Router($mockedRouter->reveal()); + + $this->assertEquals(['bar'], $router->match('/foo')); + } }