Completed
Push — master ( d998d0...abb41b )
by Kamil
38:34
created

ConfigurationTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 76
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A it_uses_app_themes_as_default_themes_location() 0 9 1
A it_does_not_add_default_theme_location_if_there_are_some_defined_by_user() 0 9 1
A it_uses_the_last_theme_locations_passed_and_rejects_the_other_ones() 0 10 1
A it_is_invalid_to_pass_a_string_as_theme_locations() 0 8 1
A it_throws_an_error_if_trying_to_set_theme_locations_to_an_empty_array() 0 8 1
A getConfiguration() 0 4 1
1
<?php
2
3
namespace Sylius\Bundle\ThemeBundle\Tests\DependencyInjection;
4
5
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
6
use Sylius\Bundle\ThemeBundle\DependencyInjection\Configuration;
7
8
/**
9
 * @author Kamil Kokot <[email protected]>
10
 */
11
class ConfigurationTest extends \PHPUnit_Framework_TestCase
12
{
13
    use ConfigurationTestCaseTrait;
14
15
    /**
16
     * @test
17
     */
18
    public function it_uses_app_themes_as_default_themes_location()
19
    {
20
        $this->assertProcessedConfigurationEquals(
21
            [
22
                [],
23
            ],
24
            ['locations' => ['%kernel.root_dir%/themes']]
25
        );
26
    }
27
28
    /**
29
     * @test
30
     */
31
    public function it_does_not_add_default_theme_location_if_there_are_some_defined_by_user()
32
    {
33
        $this->assertProcessedConfigurationEquals(
34
            [
35
                ['locations' => ['/custom/path', '/custom/path2']],
36
            ],
37
            ['locations' => ['/custom/path', '/custom/path2']]
38
        );
39
    }
40
41
    /**
42
     * @test
43
     */
44
    public function it_uses_the_last_theme_locations_passed_and_rejects_the_other_ones()
45
    {
46
        $this->assertProcessedConfigurationEquals(
47
            [
48
                ['locations' => ['/custom/path', '/custom/path2']],
49
                ['locations' => ['/last/custom/path']],
50
            ],
51
            ['locations' => ['/last/custom/path']]
52
        );
53
    }
54
55
    /**
56
     * @test
57
     */
58
    public function it_is_invalid_to_pass_a_string_as_theme_locations()
59
    {
60
        $this->assertConfigurationIsInvalid(
61
            [
62
                ['locations' => '/string/not/array'],
63
            ]
64
        );
65
    }
66
67
    /**
68
     * @test
69
     */
70
    public function it_throws_an_error_if_trying_to_set_theme_locations_to_an_empty_array()
71
    {
72
        $this->assertConfigurationIsInvalid(
73
            [
74
                ['locations' => []],
75
            ]
76
        );
77
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82
    protected function getConfiguration()
83
    {
84
        return new Configuration();
85
    }
86
}
87