Skip to content

Commit eb32d17

Browse files
committed
adding test about route key to configurableUrlMatcher
1 parent f355ff0 commit eb32d17

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Tests/NestedMatcher/ConfigurableUrlMatcherTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ public function testMatch()
5151
->method('getDefaults')
5252
->will($this->returnValue(array('foo' => 'bar')))
5353
;
54+
$this->routeDocument->expects($this->any())
55+
->method('getRouteKey')
56+
->will($this->returnValue('/routes/company/more'))
57+
;
5458

59+
// add some other routes to the collection
5560
$mockCompiled = $this->buildMock('Symfony\\Component\\Routing\\CompiledRoute');
5661
$mockCompiled->expects($this->any())
5762
->method('getStaticPrefix')
@@ -62,15 +67,17 @@ public function testMatch()
6267
->method('compile')
6368
->will($this->returnValue($mockCompiled))
6469
;
70+
6571
$routeCollection = new RouteCollection();
6672
$routeCollection->add('some', $mockRoute);
6773
$routeCollection->add('_company_more', $this->routeDocument);
6874
$routeCollection->add('other', $mockRoute);
6975

7076
$results = $this->matcher->finalMatch($routeCollection, $this->request);
7177

78+
// the matched route returns a key
7279
$expected = array(
73-
RouteObjectInterface::ROUTE_NAME => '_company_more',
80+
RouteObjectInterface::ROUTE_NAME => '/routes/company/more',
7481
RouteObjectInterface::ROUTE_OBJECT => $this->routeDocument,
7582
'foo' => 'bar',
7683
);
@@ -118,6 +125,7 @@ public function testMatchNoRouteObject()
118125

119126
$results = $this->matcher->finalMatch($routeCollection, $this->request);
120127

128+
// the matched route does not return a key
121129
$expected = array(
122130
RouteObjectInterface::ROUTE_NAME => '_company_more',
123131
RouteObjectInterface::ROUTE_OBJECT => $this->routeDocument,

0 commit comments

Comments
 (0)