GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 17370b...216ab3 )
by Benjamin
02:35
created

UrlMatcherTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 80
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testMatchCollectionReturnsWhenFound() 0 22 1
A testMatchCollectionDoesNotReturnIfNoMatch() 0 5 1
A setUp() 0 5 1
A testMatchReturnsDefaultNotFound() 0 11 1
A testMatchReturnsCorrectRoute() 0 22 1
1
<?php
2
3
namespace Tests\App\Lib\Routing;
4
5
use App\Lib\Routing\RouteLoader;
6
use App\Lib\Routing\UrlMatcher;
7
use PHPUnit\Framework\TestCase;
8
9
class UrlMatcherTest extends TestCase
10
{
11
    private $matcher;
12
13
    public function setUp()
14
    {
15
        $loader        = new RouteLoader('/../../../tests/fixtures/routing.yml');
16
        $collection    = $loader->loadRoutes();
17
        $this->matcher = new UrlMatcher($collection);
18
    }
19
20
    public function testMatchReturnsCorrectRoute()
21
    {
22
        $returnBlog = $this->matcher->match('/blog');
23
        $returnSlug = $this->matcher->match('/blog/this-is-a-post');
24
25
        $this->assertEquals(
26
            [
27
                'controller' => 'Blog',
28
                'action' => 'index',
29
                'params' => []
30
            ],
31
            $returnBlog
32
        );
33
        $this->assertEquals(
34
            [
35
                'controller' => 'Blog',
36
                'action' => 'getPost',
37
                'params' => [
38
                    'slug' => 'this-is-a-post'
39
                ]
40
            ],
41
            $returnSlug
42
        );
43
    }
44
45
    public function testMatchReturnsDefaultNotFound()
46
    {
47
        $return= $this->matcher->match('/blogo');
48
49
        $this->assertEquals(
50
            [
51
                'controller' => 'Default',
52
                'action' => 'notFound',
53
                'params' => []
54
            ],
55
            $return
56
        );
57
    }
58
59
    public function testMatchCollectionReturnsWhenFound()
60
    {
61
        $returnBlog = $this->matcher->matchCollection('/blog');
62
        $returnSlug = $this->matcher->matchCollection('/blog/this-is-a-post');
63
64
        $this->assertEquals(
65
            [
66
                'controller' => 'Blog',
67
                'action' => 'index',
68
                'params' => []
69
            ],
70
            $returnBlog
71
        );
72
        $this->assertEquals(
73
            [
74
                'controller' => 'Blog',
75
                'action' => 'getPost',
76
                'params' => [
77
                    'slug' => 'this-is-a-post'
78
                ]
79
            ],
80
            $returnSlug
81
        );
82
    }
83
84
    public function testMatchCollectionDoesNotReturnIfNoMatch()
85
    {
86
        $return = $this->matcher->matchCollection('/blogo');
87
88
        $this->assertEquals(null, $return);
89
    }
90
}
91