4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Routing\Tests\Annotation;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Routing\Annotation\Route;
17 class RouteTest extends TestCase
20 * @expectedException \BadMethodCallException
22 public function testInvalidRouteParameter()
24 $route = new Route(array('foo' => 'bar'));
28 * @dataProvider getValidParameters
30 public function testRouteParameters($parameter, $value, $getter)
32 $route = new Route(array($parameter => $value));
33 $this->assertEquals($route->$getter(), $value);
36 public function getValidParameters()
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'),