10000 [Routing] added some unit tests for the PHP loader · jeremymarc/symfony@09eb0d0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 09eb0d0

Browse files
committed
[Routing] added some unit tests for the PHP loader
1 parent c8e1e10 commit 09eb0d0

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Symfony/Component/Routing/Tests/Fixtures/validpattern.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
$collection->add('blog_show', new Route(
77
'/blog/{slug}',
88
array('_controller' => 'MyBlogBundle:Blog:show'),
9-
array(),
10-
array('compiler_class' => 'RouteCompiler')
9+
array('_method' => 'GET'),
10+
array('compiler_class' => 'RouteCompiler'),
11+
'{locale}.example.com'
1112
));
1213

1314
return $collection;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public function testLoadWithRoute()
4747
$this->assertEquals(1, count($routes), 'One route is loaded');
4848
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
4949
$route = $routes['blog_show'];
50+
$this->assertEquals('/blog/{slug}', $route->getPattern());
51+
$this->assertEquals('MyBlogBundle:Blog:show', $route->getDefault('_controller'));
52+
$this->assertEquals('GET', $route->getRequirement('_method'));
53+
$this->assertEquals('{locale}.example.com', $route->getHostnamePattern());
5054
$this->assertEquals('RouteCompiler', $route->getOption('compiler_class'));
5155
}
5256
}

0 commit comments

Comments
 (0)
0