Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / routing / Tests / Annotation / RouteTest.php
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 PHPUnit\Framework\TestCase;
15 use Symfony\Component\Routing\Annotation\Route;
16
17 class RouteTest extends TestCase
18 {
19     /**
20      * @expectedException \BadMethodCallException
21      */
22     public function testInvalidRouteParameter()
23     {
24         $route = new Route(array('foo' => 'bar'));
25     }
26
27     /**
28      * @dataProvider getValidParameters
29      */
30     public function testRouteParameters($parameter, $value, $getter)
31     {
32         $route = new Route(array($parameter => $value));
33         $this->assertEquals($route->$getter(), $value);
34     }
35
36     public function getValidParameters()
37     {
38         return array(
39             array('value', '/Blog', 'getPath'),
40             array('requirements', array('locale' => 'en'), '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', '{locale}.example.com', 'getHost'),
47             array('condition', 'context.getMethod() == "GET"', 'getCondition'),
48         );
49     }
50 }