RoutingTest::testLoadRouting()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 9
c 1
b 1
f 0
nc 1
nop 3
dl 0
loc 13
rs 9.9666
1
<?php
2
3
namespace Azine\EmailUpdateConfirmationBundle\Routing;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\Routing\Loader\YamlFileLoader;
7
use Symfony\Component\Routing\RouteCollection;
8
9
class RoutingTest extends \PHPUnit\Framework\TestCase
10
{
11
    /**
12
     * @dataProvider loadRoutingProvider
13
     *
14
     * @param string $routeName
15
     * @param string $path
16
     * @param array  $methods
17
     */
18
    public function testLoadRouting($routeName, $path, array $methods)
19
    {
20
        $locator = new FileLocator();
21
        $loader = new YamlFileLoader($locator);
22
23
        $collection = new RouteCollection();
24
        $subCollection = $loader->load(__DIR__.'/../../Resources/config/routing.yml');
25
        $collection->addCollection($subCollection);
26
27
        $route = $collection->get($routeName);
28
        $this->assertNotNull($route, sprintf('The route "%s" should exists', $routeName));
29
        $this->assertSame($path, $route->getPath());
30
        $this->assertSame($methods, $route->getMethods());
31
    }
32
33
    /**
34
     * @return array
35
     */
36
    public function loadRoutingProvider()
37
    {
38
        return array(
39
            array('user_update_email_confirm', '/confirm-email-update/{token}/{redirectRoute}', array('GET')),
40
        );
41
    }
42
}
43