Code Duplication    Length = 23-23 lines in 2 locations

tests/src/Router/Traits/HasGeneratorTraitTest.php 2 locations

@@ 18-40 (lines=23) @@
15
class HasGeneratorTraitTest extends AbstractTest
16
{
17
18
    public function testAssemble()
19
    {
20
        $router = new Router();
21
        $collection = $router->getRoutes();
22
23
        RouteFactory::generateLiteralRoute($collection, "admin.index", Route::class, "/admin", "/index");
24
        RouteFactory::generateStandardRoute($collection, "api.index", StandardRoute::class, "/api");
25
26
        self::assertSame(
27
            '/admin/index?controller=posts',
28
            $router->assemble('admin.index', ['controller' => 'posts'])
29
        );
30
31
        self::assertSame(
32
            '/api/posts/',
33
            $router->assemble('api.index', ['controller' => 'posts'])
34
        );
35
36
        self::assertSame(
37
            '/api/posts/create?test=true',
38
            $router->assemble('api.index', ['controller' => 'posts', 'action' => 'create', 'test' => 'true'])
39
        );
40
    }
41
42
    public function testGenerate()
43
    {
@@ 42-64 (lines=23) @@
39
        );
40
    }
41
42
    public function testGenerate()
43
    {
44
        $router = new Router();
45
        $collection = $router->getRoutes();
46
47
        RouteFactory::generateLiteralRoute($collection, "admin.index", Route::class, "/admin", "/index");
48
        RouteFactory::generateStandardRoute($collection, "api.index", StandardRoute::class, "/api");
49
50
        self::assertSame(
51
            '/admin/index?controller=posts',
52
            $router->generate('admin.index', ['controller' => 'posts'])
53
        );
54
55
        self::assertSame(
56
            '/api/posts',
57
            $router->generate('api.index', ['controller' => 'posts'])
58
        );
59
60
        self::assertSame(
61
            '/api/posts/create?param=test',
62
            $router->generate('api.index', ['controller' => 'posts','action' => 'create', 'param' => 'test'])
63
        );
64
    }
65
}