Completed
Push — scalar-types/theme ( 71f30c )
by Kamil
21:15
created

CompositeConfigurationProviderSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 41
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_implements_configuration_provider_interface() 0 4 1
A it_returns_empty_array_if_no_configurations_are_loaded() 0 4 1
A it_returns_sum_of_configurations_returned_by_nested_configuration_providers() 0 23 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace spec\Sylius\Bundle\ThemeBundle\Configuration;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Bundle\ThemeBundle\Configuration\CompositeConfigurationProvider;
18
use Sylius\Bundle\ThemeBundle\Configuration\ConfigurationProviderInterface;
19
20
/**
21
 * @author Kamil Kokot <[email protected]>
22
 */
23
final class CompositeConfigurationProviderSpec extends ObjectBehavior
24
{
25
    function let(): void
26
    {
27
        $this->beConstructedWith([]);
28
    }
29
30
    function it_implements_configuration_provider_interface(): void
31
    {
32
        $this->shouldImplement(ConfigurationProviderInterface::class);
33
    }
34
35
    function it_returns_empty_array_if_no_configurations_are_loaded(): void
36
    {
37
        $this->getConfigurations()->shouldReturn([]);
38
    }
39
40
    function it_returns_sum_of_configurations_returned_by_nested_configuration_providers(
41
        ConfigurationProviderInterface $firstConfigurationProvider,
42
        ConfigurationProviderInterface $secondConfigurationProvider
43
    ): void {
44
        $this->beConstructedWith([
45
            $firstConfigurationProvider,
46
            $secondConfigurationProvider,
47
        ]);
48
49
        $firstConfigurationProvider->getConfigurations()->willReturn([
50
            ['name' => 'first/theme'],
51
        ]);
52
        $secondConfigurationProvider->getConfigurations()->willReturn([
53
            ['name' => 'second/theme'],
54
            ['name' => 'third/theme'],
55
        ]);
56
57
        $this->getConfigurations()->shouldReturn([
58
            ['name' => 'first/theme'],
59
            ['name' => 'second/theme'],
60
            ['name' => 'third/theme'],
61
        ]);
62
    }
63
}
64