Test Setup Failed
Push — master ( 0c8b57...df0330 )
by Gabriel
08:06
created

LoaderTraitTest::test_registerLoader()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 18
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 18
loc 18
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace Nip\Router\Tests\ServiceProvider\Traits;
4
5
use Nip\Container\Container;
6
use Nip\Router\RouteCollection;
7
use Nip\Router\RouterServiceProvider;
8
use Nip\Router\Tests\AbstractTest;
9
use Nip\Router\Tests\Fixtures\Application\Library\Application;
10
use Symfony\Component\Config\Loader\DelegatingLoader;
11
12
/**
13
 * Class LoaderTraitTest
14
 * @package Nip\Router\Tests\ServiceProvider\Traits
15
 */
16
class LoaderTraitTest extends AbstractTest
17
{
18
19 View Code Duplication
    public function test_registerLoader()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
    {
21
        $container = new Container();
22
        $container->set('app', new Application());
23
24
        $provider = new RouterServiceProvider();
25
        $provider->setContainer($container);
26
        $provider->registerLoader();
27
28
        $loader = $container->get('routing.loader');
29
        self::assertInstanceOf(DelegatingLoader::class, $loader);
30
31
        /** @var RouteCollection $collection */
32
        $collection = $loader->load('routes.php');
33
        self::assertInstanceOf(RouteCollection::class, $collection);
34
        self::assertCount(8, $collection);
35
        self::assertTrue($collection->has('admin.index'));
36
    }
37
}
38