8000 minor #9880 test for class route annotation (ewgRa) · symfony/symfony@f499094 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f499094

Browse files
committed
minor #9880 test for class route annotation (ewgRa)
This PR was merged into the 2.5-dev branch. Discussion ---------- test for class route annotation | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | I mention that AnnotationClassLoaderTest don't test class route annotation functional. This patch add test for class route annotation Commits ------- ac94ddb test for class route annotation
2 parents 60c2140 + ac94ddb commit f499094

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,32 @@ public function testLoad($className, $routeDatas = array(), $methodArgs = array(
125125
$this->assertEquals($routeDatas['condition'], $route->getCondition(), '->load preserves condition annotation');
126126
}
127127

128+
public function testClassRouteLoad()
129+
{
130+
$classRouteDatas = array('path' => '/classRoutePrefix');
131+
132+
$routeDatas = array(
133+
'name' => 'route1',
134+
'path' => '/',
135+
);
136+
137+
$this->reader
138+
->expects($this->once())
139+
->method('getClassAnnotation')
140+
->will($this->returnValue($this->getAnnotatedRoute($classRouteDatas)))
141+
;
142+
143+
$this->reader
144+
->expects($this->once())
145+
->method('getMethodAnnotations')
146+
->will($this->returnValue(array($this->getAnnotatedRoute($routeDatas))))
147+
;
148+
$routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass');
149+
$route = $routeCollection->get($routeDatas['name']);
150+
151+
$this->assertSame($classRouteDatas['path'].$routeDatas['path'], $route->getPath(), '->load preserves class route path annotation');
152+
}
153+
128154
private function getAnnotatedRoute($datas)
129155
{
130156
return new Route($datas);

0 commit comments

Comments
 (0)
0