Completed
Push — master ( c5de01...c9c19d )
by
unknown
07:34 queued 05:10
created

RequestSpec   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 35
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_throw_exception_when_created_with_not_string_route() 0 4 1
A it_throw_exception_when_created_with_empty_route() 0 4 1
A it_always_uppercase_allowed_methods() 0 5 1
A it_always_return_path_with_slash_at_the_beginning() 0 5 1
A it_always_return_path_with_single_slash_at_the_beginning() 0 5 1
1
<?php
2
3
namespace spec\Coduo\TuTu\Config\Element;
4
5
use PhpSpec\ObjectBehavior;
6
use Prophecy\Argument;
7
8
class RequestSpec extends ObjectBehavior
9
{
10
    function let()
11
    {
12
        $this->beConstructedWith('/foo');
13
    }
14
15
    function it_throw_exception_when_created_with_not_string_route()
16
    {
17
        $this->shouldThrow(new \InvalidArgumentException('Path must be a valid string.'))->during('__construct', [new \DateTime()]);
18
    }
19
20
    function it_throw_exception_when_created_with_empty_route()
21
    {
22
        $this->shouldThrow(new \InvalidArgumentException('Path can\'t be empty.'))->during('__construct', ['']);
23
    }
24
25
    function it_always_uppercase_allowed_methods()
26
    {
27
        $this->setAllowedMethods(['post', 'GeT']);
28
        $this->getAllowedMethods()->shouldReturn(['POST', 'GET']);
29
    }
30
31
    function it_always_return_path_with_slash_at_the_beginning()
32
    {
33
        $this->beConstructedWith('foo');
34
        $this->getPath()->shouldReturn('/foo');
35
    }
36
37
    function it_always_return_path_with_single_slash_at_the_beginning()
38
    {
39
        $this->beConstructedWith('//foo');
40
        $this->getPath()->shouldReturn('/foo');
41
    }
42
}
43