diff options
Diffstat (limited to 'vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation')
-rw-r--r-- | vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php new file mode 100644 index 00000000..b58869f7 --- /dev/null +++ b/vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php | |||
@@ -0,0 +1,49 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Routing\Tests\Annotation; | ||
13 | |||
14 | use Symfony\Component\Routing\Annotation\Route; | ||
15 | |||
16 | class RouteTest extends \PHPUnit_Framework_TestCase | ||
17 | { | ||
18 | /** | ||
19 | * @expectedException \BadMethodCallException | ||
20 | */ | ||
21 | public function testInvalidRouteParameter() | ||
22 | { | ||
23 | $route = new Route(array('foo' => 'bar')); | ||
24 | } | ||
25 | |||
26 | /** | ||
27 | * @dataProvider getValidParameters | ||
28 | */ | ||
29 | public function testRouteParameters($parameter, $value, $getter) | ||
30 | { | ||
31 | $route = new Route(array($parameter => $value)); | ||
32 | $this->assertEquals($route->$getter(), $value); | ||
33 | } | ||
34 | |||
35 | public function getValidParameters() | ||
36 | { | ||
37 | return array( | ||
38 | array('value', '/Blog', 'getPattern'), | ||
39 | array('value', '/Blog', 'getPath'), | ||
40 | array('requirements', array('_method' => 'GET'), 'getRequirements'), | ||
41 | array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), | ||
42 | array('name', 'blog_index', 'getName'), | ||
43 | array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults'), | ||
44 | array('schemes', array('https'), 'getSchemes'), | ||
45 | array('methods', array('GET', 'POST'), 'getMethods'), | ||
46 | array('host', array('{locale}.example.com'), 'getHost') | ||
47 | ); | ||
48 | } | ||
49 | } | ||