Completed
Push — master ( b63fa9...5110b4 )
by Kamil
04:39
created

it_returns_container_and_service_identifiers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace spec\FriendsOfBehat\CrossContainerExtension;
4
5
use PhpSpec\ObjectBehavior;
6
7
final class ExternalReferenceSpec extends ObjectBehavior
8
{
9
    function let()
10
    {
11
        $this->beConstructedWith('__container_identifier__.service_identifier');
12
    }
13
14
    function it_returns_whether_it_is_valid()
15
    {
16
        static::isValid('not_valid')->shouldReturn(false);
17
        static::isValid('__not.valid')->shouldReturn(false);
18
        static::isValid('_not_.valid')->shouldReturn(false);
19
        static::isValid('__not.valid__')->shouldReturn(false);
20
        static::isValid('__not_valid__')->shouldReturn(false);
21
22
        static::isValid('__valid__.indeed')->shouldReturn(true);
23
        static::isValid('__still__valid__.indeed')->shouldReturn(true);
24
    }
25
26
    function it_returns_container_and_service_identifiers()
27
    {
28
        $this->containerIdentifier()->shouldReturn('container_identifier');
29
        $this->serviceIdentifier()->shouldReturn('service_identifier');
30
    }
31
32
    function it_throws_an_exception_if_trying_to_create_with_invalid_identifier()
33
    {
34
        $this->beConstructedWith('__not.valid__');
35
36
        $this->shouldThrow(\InvalidArgumentException::class)->duringInstantiation();
37
    }
38
}
39