Completed
Push — develop ( 9f43d2...2581dc )
by Filipe
01:49
created

FactorySpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 37
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace spec\Slick\Di\Definition;
4
5
use Slick\Di\Definition\Factory;
6
use PhpSpec\ObjectBehavior;
7
use Prophecy\Argument;
8
use Slick\Di\DefinitionInterface;
9
10
class FactorySpec extends ObjectBehavior
11
{
12
    function let()
13
    {
14
        $this->beConstructedWith(
15
            function (){
16
                return 'Test Callable';
17
            }
18
        );
19
    }
20
21
    function it_is_initializable()
22
    {
23
        $this->shouldHaveType(Factory::class);
24
    }
25
26
    function its_a_definition()
27
    {
28
        $this->shouldBeAnInstanceOf(DefinitionInterface::class);
29
    }
30
31
    function it_resolves_to_the_callable_return()
32
    {
33
        $this->resolve()->shouldBe('Test Callable');
34
    }
35
36
    function it_can_have_parameters_to_pass_to_callable_on_resolve()
37
    {
38
        $this->beConstructedWith(
39
            function ($test) {
40
                return $test;
41
            },
42
            ['test with parameters']
43
        );
44
        $this->resolve()->shouldBe('test with parameters');
45
    }
46
}
47