Completed
Pull Request — master (#16)
by Nikola
01:29
created

ConfigurationTest::itHasReasonableDefaults()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 21
rs 9.3142
cc 1
eloc 14
nc 1
nop 0
1
<?php
2
/**
3
 * Go! AOP framework
4
 *
5
 * @copyright Copyright 2015, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Go\Symfony\GoAopBundle\Tests\DependencyInjection;
12
13
use Go\Symfony\GoAopBundle\DependencyInjection\Configuration;
14
use Go\Symfony\GoAopBundle\DependencyInjection\GoAopExtension;
15
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionConfigurationTestCase;
16
17
/**
18
 * Class ConfigurationTest
19
 */
20
class ConfigurationTest extends AbstractExtensionConfigurationTestCase
21
{
22
    /**
23
     * @test
24
     */
25
    public function itHasReasonableDefaults()
26
    {
27
        $expectedConfiguration = [
28
            'cache_warmer'     => true,
29
            'doctrine_support' => false,
30
            'options'          => [
31
                'features'      => 0,
32
                'app_dir'       => '%kernel.root_dir%/../src',
33
                'cache_dir'     => '%kernel.cache_dir%/aspect',
34
                'debug'         => '%kernel.debug%',
35
                'include_paths' => [],
36
                'exclude_paths' => [],
37
            ],
38
        ];
39
40
        $sources = [
41
            __DIR__ . '/../Fixtures/config/empty.xml',
42
        ];
43
44
        $this->assertProcessedConfigurationEquals($expectedConfiguration, $sources);
45
    }
46
47
    /**
48
     * @test
49
     */
50 View Code Duplication
    public function itCanBeFullyConfiguredViaYml()
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
        $expectedConfiguration = [
53
            'cache_warmer'     => false,
54
            'doctrine_support' => true,
55
            'options'          => [
56
                'debug'           => false,
57
                'features'        => 7,
58
                'app_dir'         => '/my/app/dir',
59
                'cache_dir'       => '/my/cache/dir',
60
                'include_paths'   => [
61
                    '/path/to/include',
62
                    '/other/path/to/include',
63
                ],
64
                'exclude_paths'   => [
65
                    '/path/to/exclude',
66
                    '/other/path/to/exclude',
67
                ],
68
                'container_class' => 'Container\Class',
69
            ],
70
        ];
71
72
        $sources = [
73
            __DIR__ . '/../Fixtures/config/full.yml',
74
        ];
75
76
        $this->assertProcessedConfigurationEquals($expectedConfiguration, $sources);
77
    }
78
79
    /**
80
     * @test
81
     */
82 View Code Duplication
    public function itCanBeFullyConfiguredViaXml()
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...
83
    {
84
        $expectedConfiguration = [
85
            'cache_warmer'     => false,
86
            'doctrine_support' => true,
87
            'options'          => [
88
                'debug'           => false,
89
                'features'        => 7,
90
                'app_dir'         => '/my/app/dir',
91
                'cache_dir'       => '/my/cache/dir',
92
                'include_paths'   => [
93
                    '/path/to/include',
94
                    '/other/path/to/include',
95
                ],
96
                'exclude_paths'   => [
97
                    '/path/to/exclude',
98
                    '/other/path/to/exclude',
99
                ],
100
                'container_class' => 'Container\Class',
101
            ],
102
        ];
103
104
        $sources = [
105
            __DIR__ . '/../Fixtures/config/full.xml',
106
        ];
107
108
        $this->assertProcessedConfigurationEquals($expectedConfiguration, $sources);
109
    }
110
111
    /**
112
     * {@inheritdoc}
113
     */
114
    protected function getContainerExtension()
115
    {
116
        return new GoAopExtension();
117
    }
118
119
    /**
120
     * {@inheritdoc}
121
     */
122
    protected function getConfiguration()
123
    {
124
        return new Configuration();
125
    }
126
}
127