public function UrlMatcherTest::doTestMatchRouteKey in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony-cmf/routing/Tests/NestedMatcher/UrlMatcherTest.php \Symfony\Cmf\Component\Routing\Tests\NestedMatcher\UrlMatcherTest::doTestMatchRouteKey()
2 calls to UrlMatcherTest::doTestMatchRouteKey()
- UrlMatcherTest::testMatchNoKey in vendor/
symfony-cmf/ routing/ Tests/ NestedMatcher/ UrlMatcherTest.php - UrlMatcherTest::testMatchRouteKey in vendor/
symfony-cmf/ routing/ Tests/ NestedMatcher/ UrlMatcherTest.php
File
- vendor/
symfony-cmf/ routing/ Tests/ NestedMatcher/ UrlMatcherTest.php, line 55
Class
Namespace
Symfony\Cmf\Component\Routing\Tests\NestedMatcherCode
public function doTestMatchRouteKey($routeKey) {
$this->routeCompiled
->expects($this
->atLeastOnce())
->method('getStaticPrefix')
->will($this
->returnValue($this->url));
$this->routeCompiled
->expects($this
->atLeastOnce())
->method('getRegex')
->will($this
->returnValue('#' . str_replace('/', '\\/', $this->url) . '#'));
$this->routeDocument
->expects($this
->atLeastOnce())
->method('compile')
->will($this
->returnValue($this->routeCompiled));
$this->routeDocument
->expects($this
->atLeastOnce())
->method('getRouteKey')
->will($this
->returnValue($routeKey));
$this->routeDocument
->expects($this
->atLeastOnce())
->method('getDefaults')
->will($this
->returnValue(array(
'foo' => 'bar',
)));
$mockCompiled = $this
->buildMock('Symfony\\Component\\Routing\\CompiledRoute');
$mockCompiled
->expects($this
->any())
->method('getStaticPrefix')
->will($this
->returnValue('/no/match'));
$mockRoute = $this
->getMockBuilder('Symfony\\Component\\Routing\\Route')
->disableOriginalConstructor()
->getMock();
$mockRoute
->expects($this
->any())
->method('compile')
->will($this
->returnValue($mockCompiled));
$routeCollection = new RouteCollection();
$routeCollection
->add('some', $mockRoute);
$routeCollection
->add('_company_more', $this->routeDocument);
$routeCollection
->add('other', $mockRoute);
$results = $this->matcher
->finalMatch($routeCollection, $this->request);
$expected = array(
RouteObjectInterface::ROUTE_NAME => $routeKey ? $routeKey : '_company_more',
RouteObjectInterface::ROUTE_OBJECT => $this->routeDocument,
'foo' => 'bar',
);
$this
->assertEquals($expected, $results);
}