Passed
Branch master (e8fd46)
by Alexey
02:50
created

RouteSpec   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 69
rs 10
c 0
b 0
f 0
wmc 9
lcom 0
cbo 1
1
<?php
2
3
namespace spec\Venta\Routing;
4
5
use PhpSpec\ObjectBehavior;
6
7
class RouteSpec extends ObjectBehavior
8
{
9
10
    function let()
11
    {
12
        $this->beConstructedWith(['GET'], 'url', 'responder');
13
    }
14
15
    function it_has_immutable_domain()
16
    {
17
        $route = $this->withDomain('domain');
18
        $route->getDomain()->shouldBe('domain');
19
        $this->getDomain()->shouldBe('');
20
    }
21
22
    function it_has_immutable_host()
23
    {
24
        $route = $this->withHost('host');
25
        $route->getHost()->shouldBe('host');
26
        $this->getHost()->shouldBe('');
27
    }
28
29
    function it_has_immutable_input()
30
    {
31
        $route = $this->withInput('input');
32
        $route->getInput()->shouldBe('input');
33
        $this->getInput()->shouldBe('');
34
    }
35
    
36
    function it_has_immutable_name()
37
    {
38
        $route = $this->withName('named');
39
        $route->getName()->shouldBe('named');
40
        $this->getName()->shouldBe('');
41
    }
42
43
    function it_has_immutable_scheme()
44
    {
45
        $route = $this->withScheme('https');
46
        $route->getScheme()->shouldBe('https');
47
        $this->getScheme()->shouldBe('');
48
    }
49
50
    function it_has_middleware_list()
51
    {
52
        $route = $this->withMiddleware('middleware');
53
        $route->getMiddlewares()->shouldContain('middleware');
54
        $this->getMiddlewares()->shouldBe([]);
55
    }
56
57
    function it_implements_route_contract()
58
    {
59
        $this->shouldHaveType(\Venta\Contracts\Routing\Route::class);
60
    }
61
62
    function it_is_initializable()
63
    {
64
        $this->getPath()->shouldBe('/url');
65
        $this->getResponder()->shouldBe('responder');
66
        $this->getMethods()->shouldContain('GET');
67
        $this->getHost()->shouldBe('');
68
        $this->getScheme()->shouldBe('');
69
        $this->getName()->shouldBe('');
70
        $this->getInput()->shouldBe('');
71
        $this->getDomain()->shouldBe('');
72
    }
73
74
75
}
76