Test Failed
Pull Request — master (#34)
by Anatoly
02:07
created

RouteCollectionTest::testCreateRouteForHttpMethodAny()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 20
nc 1
nop 0
dl 0
loc 25
rs 9.6
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Sunrise\Http\Router\Tests;
4
5
/**
6
 * Import classes
7
 */
8
use PHPUnit\Framework\TestCase;
9
use Sunrise\Http\Router\RouteCollection;
10
use Sunrise\Http\Router\RouteCollectionInterface;
11
12
/**
13
 * RouteCollectionTest
14
 */
15
class RouteCollectionTest extends TestCase
16
{
17
18
    /**
19
     * @return void
20
     */
21
    public function testConstructor() : void
22
    {
23
        $collection = new RouteCollection();
24
25
        $this->assertInstanceOf(RouteCollectionInterface::class, $collection);
26
    }
27
28
    /**
29
     * @return void
30
     */
31
    public function testConstructorWithRoutes() : void
32
    {
33
        $routes = [
34
            new Fixture\TestRoute(),
35
            new Fixture\TestRoute(),
36
            new Fixture\TestRoute(),
37
        ];
38
39
        $collection = new RouteCollection(...$routes);
40
41
        $this->assertSame($routes, $collection->all());
42
    }
43
44
    /**
45
     * @return void
46
     */
47
    public function testAdd() : void
48
    {
49
        $routes = [
50
            new Fixture\TestRoute(),
51
            new Fixture\TestRoute(),
52
            new Fixture\TestRoute(),
53
        ];
54
55
        $collection = new RouteCollection();
56
57
        $collection->add(...$routes);
58
59
        $this->assertSame($routes, $collection->all());
60
    }
61
}
62