ContainerBasedContainerAccessorSpec::let()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the CrossContainerExtension package.
7
 *
8
 * (c) Kamil Kokot <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace spec\FriendsOfBehat\CrossContainerExtension;
15
16
use FriendsOfBehat\CrossContainerExtension\ContainerAccessor;
17
use PhpSpec\ObjectBehavior;
18
use Symfony\Component\DependencyInjection\Container;
19
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
20
21
final class ContainerBasedContainerAccessorSpec extends ObjectBehavior
22
{
23
    function let(Container $container): void
24
    {
25
        $this->beConstructedWith($container);
26
    }
27
28
    function it_is_a_container_accessor(): void
29
    {
30
        $this->shouldImplement(ContainerAccessor::class);
31
    }
32
33
    function it_gets_a_service(Container $container): void
34
    {
35
        $service = new \stdClass();
36
37
        $container->get('acme')->willReturn($service);
38
39
        $this->getService('acme')->shouldReturn($service);
40
    }
41
42 View Code Duplication
    function it_gets_parameters_from_frozen_container(Container $container): void
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
    {
44
        $container->isCompiled()->willReturn(true);
45
        $container->getParameterBag()->willReturn(new ParameterBag(['name' => 'value']));
46
47
        $this->getParameters()->shouldReturn(['name' => 'value']);
48
    }
49
50 View Code Duplication
    function it_gets_parameters_from_not_frozen_container(Container $container): void
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
51
    {
52
        $container->isCompiled()->willReturn(false);
53
        $container->getParameterBag()->willReturn(new ParameterBag(['name' => 'value']));
54
55
        $this->getParameters()->shouldReturn(['name' => 'value']);
56
    }
57
}
58