Completed
Branch master (df0330)
by Gabriel
08:50 queued 06:43
created

LoaderTraitTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 81.82 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
dl 18
loc 22
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_registerLoader() 18 18 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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