Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion tests/Bridge/Symfony/Routing/RouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand All @@ -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'));
}
}