Test Setup Failed
Push — master ( ecdc34...0769f8 )
by Gabriel
02:46 queued 11s
created

test_generateGenericModuleDefaultRoutes_no_namespace()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 12
loc 12
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
namespace Nip\Router\Tests\RouteFactory;
4
5
use Nip\Router\Route\LiteralRoute;
6
use Nip\Router\Route\StandardRoute;
7
use Nip\Router\RouteCollection;
8
use Nip\Router\RouteFactory;
9
use Nip\Router\Tests\AbstractTest;
10
use Nip\Router\Tests\Fixtures\Application\Modules\Admin\Routes\LiteralRoute as AdminLiteralRoute;
11
use Nip\Router\Tests\Fixtures\Application\Modules\Admin\Routes\StandardRoute as AdminStandardRoute;
12
13
/**
14
 * Class HasModulesRoutesTraitTest
15
 * @package Nip\Router\Tests\RouteFactory
16
 */
17
class HasModulesRoutesTraitTest extends AbstractTest
18
{
19 View Code Duplication
    public function test_generateGenericModuleDefaultRoutes_no_namespace()
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
        $collection = new RouteCollection();
22
        RouteFactory::generateGenericModuleDefaultRoutes($collection, "admin", '/admin');
23
24
        self::assertCount(4, $collection);
25
26
        self::assertInstanceOf(LiteralRoute::class, $collection->get('admin.slash'));
27
        self::assertInstanceOf(LiteralRoute::class, $collection->get('admin'));
28
        self::assertInstanceOf(StandardRoute::class, $collection->get('admin.default'));
29
        self::assertInstanceOf(StandardRoute::class, $collection->get('admin.default.index'));
30
    }
31
32 View Code Duplication
    public function test_generateGenericModuleDefaultRoutes_with_namespace()
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...
33
    {
34
        $collection = new RouteCollection();
35
        RouteFactory::generateGenericModuleDefaultRoutes($collection,
36
            ["admin", "Nip\Router\Tests\Fixtures\Application\\"], '/admin');
37
38
        self::assertCount(4, $collection);
39
40
        self::assertInstanceOf(AdminLiteralRoute::class, $collection->get('admin.slash'));
41
        self::assertInstanceOf(AdminLiteralRoute::class, $collection->get('admin'));
42
        self::assertInstanceOf(AdminStandardRoute::class, $collection->get('admin.default'));
43
        self::assertInstanceOf(AdminStandardRoute::class, $collection->get('admin.default.index'));
44
    }
45
46 View Code Duplication
    public function test_generateGenericModuleDefaultRoutes_with_namespace_missing_classes()
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...
47
    {
48
        $collection = new RouteCollection();
49
        RouteFactory::generateGenericModuleDefaultRoutes($collection,
50
            ["frontend", "Nip\Router\Tests\Fixtures\Application\\"], '/admin');
51
52
        self::assertCount(4, $collection);
53
54
        self::assertInstanceOf(LiteralRoute::class, $collection->get('frontend.slash'));
55
        self::assertInstanceOf(LiteralRoute::class, $collection->get('frontend'));
56
        self::assertInstanceOf(StandardRoute::class, $collection->get('frontend.default'));
57
        self::assertInstanceOf(StandardRoute::class, $collection->get('frontend.default.index'));
58
    }
59
}
60