RouteTest::testConstruct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 2
Metric Value
cc 1
eloc 19
nc 1
nop 0
dl 0
loc 24
rs 9.6333
c 4
b 0
f 2
1
<?php
2
class RouteTest extends \PHPUnit\Framework\TestCase
3
{
4
    public function testConstruct()
5
    {
6
        $name = 'myRoute';
7
        $method = 'any';
8
        $path = '/test-uri';
9
        $request = new Suricate\Request();
10
        $routeTarget = 'myController::myMethod';
11
        $parametersDefinitions = [];
12
        $middleware = null;
13
14
        $route = new Suricate\Route(
15
            $name,
16
            $method,
17
            $path,
18
            $request,
19
            $routeTarget,
0 ignored issues
show
Bug introduced by
$routeTarget of type string is incompatible with the type array|null expected by parameter $routeTarget of Suricate\Route::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

19
            /** @scrutinizer ignore-type */ $routeTarget,
Loading history...
20
            $parametersDefinitions,
21
            $middleware
22
        );
23
24
        $this->assertEquals($path, $route->getPath());
25
        $this->assertEquals(['any'], $route->getMethod());
26
        $this->assertEquals($name, $route->getName());
27
        $this->assertEquals([], $route->getParameters());
28
    }
29
}
30