Overview

Namespaces

  • Evenement
  • None
  • PHP
  • Psr
    • Http
      • Message
  • Ratchet
    • Http
    • RFC6455
      • Handshake
      • Messaging
    • Server
    • Session
      • Serialize
      • Storage
        • Proxy
    • Wamp
    • WebSocket
  • React
    • EventLoop
      • Tick
      • Timer
    • Socket
    • Stream
  • Symfony
    • Component
      • HttpFoundation
        • Session
          • Attribute
          • Flash
          • Storage
            • Handler
            • Proxy
      • Routing
        • Annotation
        • Exception
        • Generator
          • Dumper
        • Loader
          • DependencyInjection
        • Matcher
          • Dumper
        • Tests
          • Annotation
          • Fixtures
            • AnnotatedClasses
            • OtherAnnotatedClasses
          • Generator
            • Dumper
          • Loader
          • Matcher
            • Dumper

Classes

  • RouteTest
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: /*
 4:  * This file is part of the Symfony package.
 5:  *
 6:  * (c) Fabien Potencier <[email protected]>
 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: 
51:     /**
52:      * @group legacy
53:      */
54:     public function testLegacyGetPattern()
55:     {
56:         $route = new Route(array('value' => '/Blog'));
57:         $this->assertEquals($route->getPattern(), '/Blog');
58:     }
59: }
60: 
Ratchet API documentation generated by ApiGen 2.8.0