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

AliasSpec::it_is_initializable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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