Completed
Push — 1.0-remove-composer-lock ( a44571 )
by Kamil
45:19
created

ConfigurationTest   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 116
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 3
dl 0
loc 116
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A it_has_default_context_service_set() 0 10 1
A its_context_cannot_be_empty() 0 9 1
A its_context_can_be_overridden() 0 10 1
A assets_support_is_enabled_by_default() 0 4 1
A assets_support_may_be_toggled() 0 9 1
A templating_support_is_enabled_by_default() 0 4 1
A templating_support_may_be_toggled() 0 9 1
A translations_support_is_enabled_by_default() 0 4 1
A translations_support_may_be_toggled() 0 9 1
A getConfiguration() 0 4 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 Sylius\Bundle\ThemeBundle\Tests\DependencyInjection;
15
16
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
17
use Sylius\Bundle\ThemeBundle\DependencyInjection\Configuration;
18
use Symfony\Component\Config\Definition\ConfigurationInterface;
19
20
final class ConfigurationTest extends \PHPUnit_Framework_TestCase
21
{
22
    use ConfigurationTestCaseTrait;
23
24
    /**
25
     * @test
26
     */
27
    public function it_has_default_context_service_set(): void
28
    {
29
        $this->assertProcessedConfigurationEquals(
30
            [
31
                [],
32
            ],
33
            ['context' => 'sylius.theme.context.settable'],
34
            'context'
35
        );
36
    }
37
38
    /**
39
     * @test
40
     */
41
    public function its_context_cannot_be_empty(): void
42
    {
43
        $this->assertPartialConfigurationIsInvalid(
44
            [
45
                [''],
46
            ],
47
            'context'
48
        );
49
    }
50
51
    /**
52
     * @test
53
     */
54
    public function its_context_can_be_overridden(): void
55
    {
56
        $this->assertProcessedConfigurationEquals(
57
            [
58
                ['context' => 'sylius.theme.context.custom'],
59
            ],
60
            ['context' => 'sylius.theme.context.custom'],
61
            'context'
62
        );
63
    }
64
65
    /**
66
     * @test
67
     */
68
    public function assets_support_is_enabled_by_default()
69
    {
70
        $this->assertProcessedConfigurationEquals([[]], ['assets' => ['enabled' => true]], 'assets');
71
    }
72
73
    /**
74
     * @test
75
     */
76
    public function assets_support_may_be_toggled()
77
    {
78
        $this->assertProcessedConfigurationEquals([['assets' => ['enabled' => true]]], ['assets' => ['enabled' => true]], 'assets');
79
        $this->assertProcessedConfigurationEquals([['assets' => []]], ['assets' => ['enabled' => true]], 'assets');
80
        $this->assertProcessedConfigurationEquals([['assets' => null]], ['assets' => ['enabled' => true]], 'assets');
81
82
        $this->assertProcessedConfigurationEquals([['assets' => ['enabled' => false]]], ['assets' => ['enabled' => false]], 'assets');
83
        $this->assertProcessedConfigurationEquals([['assets' => false]], ['assets' => ['enabled' => false]], 'assets');
84
    }
85
86
    /**
87
     * @test
88
     */
89
    public function templating_support_is_enabled_by_default()
90
    {
91
        $this->assertProcessedConfigurationEquals([[]], ['templating' => ['enabled' => true]], 'templating');
92
    }
93
94
    /**
95
     * @test
96
     */
97
    public function templating_support_may_be_toggled()
98
    {
99
        $this->assertProcessedConfigurationEquals([['templating' => ['enabled' => true]]], ['templating' => ['enabled' => true]], 'templating');
100
        $this->assertProcessedConfigurationEquals([['templating' => []]], ['templating' => ['enabled' => true]], 'templating');
101
        $this->assertProcessedConfigurationEquals([['templating' => null]], ['templating' => ['enabled' => true]], 'templating');
102
103
        $this->assertProcessedConfigurationEquals([['templating' => ['enabled' => false]]], ['templating' => ['enabled' => false]], 'templating');
104
        $this->assertProcessedConfigurationEquals([['templating' => false]], ['templating' => ['enabled' => false]], 'templating');
105
    }
106
107
    /**
108
     * @test
109
     */
110
    public function translations_support_is_enabled_by_default()
111
    {
112
        $this->assertProcessedConfigurationEquals([[]], ['translations' => ['enabled' => true]], 'translations');
113
    }
114
115
    /**
116
     * @test
117
     */
118
    public function translations_support_may_be_toggled()
119
    {
120
        $this->assertProcessedConfigurationEquals([['translations' => ['enabled' => true]]], ['translations' => ['enabled' => true]], 'translations');
121
        $this->assertProcessedConfigurationEquals([['translations' => []]], ['translations' => ['enabled' => true]], 'translations');
122
        $this->assertProcessedConfigurationEquals([['translations' => null]], ['translations' => ['enabled' => true]], 'translations');
123
124
        $this->assertProcessedConfigurationEquals([['translations' => ['enabled' => false]]], ['translations' => ['enabled' => false]], 'translations');
125
        $this->assertProcessedConfigurationEquals([['translations' => false]], ['translations' => ['enabled' => false]], 'translations');
126
    }
127
128
    /**
129
     * {@inheritdoc}
130
     */
131
    protected function getConfiguration(): ConfigurationInterface
132
    {
133
        return new Configuration();
134
    }
135
}
136