Completed
Branch develop (9f43d2)
by Filipe
05:14
created

AliasSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 29
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A its_a_definition() 0 4 1
A it_uses_the_container_to_search_for_other_definitions() 0 6 1
A it_throws_container_not_set_exception_if_no_container_is_present() 0 5 1
1
<?php
2
3
namespace spec\Slick\Di\Definition;
4
5
use Slick\Di\ContainerInterface;
6
use Slick\Di\Definition\Alias;
7
use PhpSpec\ObjectBehavior;
8
use Prophecy\Argument;
9
use Slick\Di\DefinitionInterface;
10
use Slick\Di\Exception\ContainerNotSetException;
11
12
class AliasSpec extends ObjectBehavior
13
{
14
    function let()
15
    {
16
        $this->beConstructedWith('@foo');
17
    }
18
    function it_is_initializable()
19
    {
20
        $this->shouldHaveType(Alias::class);
21
    }
22
23
    function its_a_definition()
24
    {
25
        $this->shouldBeAnInstanceOf(DefinitionInterface::class);
26
    }
27
28
    function it_uses_the_container_to_search_for_other_definitions(ContainerInterface $container)
29
    {
30
        $container->get('foo')->willReturn('bar');
31
        $this->setContainer($container);
32
        $this->resolve()->shouldReturn('bar');
33
    }
34
35
    function it_throws_container_not_set_exception_if_no_container_is_present()
36
    {
37
        $this->shouldThrow(ContainerNotSetException::class)
38
            ->during('resolve');
39
    }
40
}
41