Subversion Repositories php-qbpwcf

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 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', 'getPath'),
39
            array('requirements', array('locale' => 'en'), 'getRequirements'),
40
            array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'),
41
            array('name', 'blog_index', 'getName'),
42
            array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults'),
43
            array('schemes', array('https'), 'getSchemes'),
44
            array('methods', array('GET', 'POST'), 'getMethods'),
45
            array('host', '{locale}.example.com', 'getHost'),
46
            array('condition', 'context.getMethod() == "GET"', 'getCondition'),
47
        );
48
    }
49
}