Completed
Pull Request — master (#244)
by Łukasz
11:47
created

ContextManagerSpec::let()   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 1
1
<?php
2
3
/**
4
 * (c) FSi sp. z o.o. <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace spec\FSi\Bundle\AdminBundle\Admin\Context;
11
12
use PhpSpec\ObjectBehavior;
13
14
class ContextManagerSpec extends ObjectBehavior
15
{
16
    /**
17
     * @param \FSi\Bundle\AdminBundle\Admin\Context\ContextInterface $context
18
     */
19
    function let($context)
20
    {
21
        $this->beConstructedWith(array($context));
22
    }
23
24
    /**
25
     * @param \FSi\Bundle\AdminBundle\Admin\Element $element
26
     * @param \FSi\Bundle\AdminBundle\Admin\Context\ContextInterface $context
27
     */
28
    function it_build_context_for_element($element, $context)
29
    {
30
        $context->supports('route_name', $element)->willReturn(true);
31
        $context->setElement($element)->shouldBeCalled();
32
33
        $this->createContext('route_name', $element)->shouldReturn($context);
34
    }
35
36
    /**
37
     * @param \FSi\Bundle\AdminBundle\Admin\Element $element
38
     * @param \FSi\Bundle\AdminBundle\Admin\Context\ContextInterface $context
39
     */
40
    function it_return_null_when_context_builders_do_not_support_element($element, $context)
41
    {
42
        $context->supports('route_name', $element)->willReturn(false);
43
        $context->setElement($element)->shouldNotBeCalled();
44
45
        $this->createContext('route_name', $element)->shouldReturn(null);
46
    }
47
}
48