1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 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: 21:
22: public function testInvalidRouteParameter()
23: {
24: $route = new Route(array('foo' => 'bar'));
25: }
26:
27: 28: 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:
51: 52: 53:
54: public function testLegacyGetPattern()
55: {
56: $route = new Route(array('value' => '/Blog'));
57: $this->assertEquals($route->getPattern(), '/Blog');
58: }
59: }
60: