GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AbstractOnurbYumlExtensionTest   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 167
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 12
lcom 1
cbo 5
dl 0
loc 167
rs 10
c 0
b 0
f 0

13 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 10 1
loadConfiguration() 0 1 ?
A testDefaultConfiguration() 0 7 1
A testDefaultParams() 0 13 1
A testTrueConfiguration() 0 10 1
A testFalseConfiguration() 0 10 1
A testPartialConfiguration() 0 13 1
A testArrayColorsConfiguration() 0 15 1
A testArrayNotesConfiguration() 0 15 1
A testStyleScruffy() 0 12 1
A testExtensionSvg() 0 12 1
A testDirectionLR() 0 12 1
A testScaleTiny() 0 12 1
1
<?php
2
namespace OnurbTest\Bundle\YumlBundle\DependencyInjection;
3
4
use Onurb\Bundle\YumlBundle\DependencyInjection\OnurbYumlExtension;
5
use PHPUnit\Framework\TestCase;
6
use Symfony\Component\Config\FileLocator;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Loader;
9
10
abstract class AbstractOnurbYumlExtensionTest extends TestCase
11
{
12
    /**
13
     * @var OnurbYumlExtension
14
     */
15
    private $extension;
16
17
    /**
18
     * @var ContainerBuilder
19
     */
20
    private $container;
21
22
    protected function setUp()
23
    {
24
        $this->extension = new OnurbYumlExtension();
25
        $this->container = new ContainerBuilder();
26
27
        $this->container->registerExtension($this->extension);
28
29
        $loader = new Loader\YamlFileLoader($this->container, new FileLocator(__DIR__ . '/Fixtures/'));
30
        $loader->load('fake_doctrine_service.yml');
31
    }
32
33
    abstract protected function loadConfiguration(ContainerBuilder $container, $resource);
34
35
    public function testDefaultConfiguration()
36
    {
37
        $this->container->loadFromExtension($this->extension->getAlias());
38
        $this->container->compile();
39
40
        $this->assertFalse($this->container->has('onurb_yuml'));
41
    }
42
43
    public function testDefaultParams()
44
    {
45
        $this->container->loadFromExtension($this->extension->getAlias());
46
        $this->container->compile();
47
48
        $this->assertTrue($this->container->getParameter('onurb_yuml.show_fields_description'));
49
        $this->assertSame(array(), $this->container->getParameter('onurb_yuml.colors'));
50
        $this->assertSame(array(), $this->container->getParameter('onurb_yuml.notes'));
51
        $this->assertSame('png', $this->container->getParameter('onurb_yuml.extension'));
52
        $this->assertSame('plain', $this->container->getParameter('onurb_yuml.style'));
53
        $this->assertSame('TB', $this->container->getParameter('onurb_yuml.direction'));
54
        $this->assertSame('normal', $this->container->getParameter('onurb_yuml.scale'));
55
    }
56
57
    public function testTrueConfiguration()
58
    {
59
        $this->container->loadFromExtension($this->extension->getAlias());
60
        $this->loadConfiguration($this->container, 'config_true');
61
        $this->container->compile();
62
63
        $this->assertTrue($this->container->getParameter('onurb_yuml.show_fields_description'));
64
        $this->assertSame(array(), $this->container->getParameter('onurb_yuml.colors'));
65
        $this->assertSame(array(), $this->container->getParameter('onurb_yuml.notes'));
66
    }
67
68
    public function testFalseConfiguration()
69
    {
70
        $this->container->loadFromExtension($this->extension->getAlias());
71
        $this->loadConfiguration($this->container, 'config_false');
72
        $this->container->compile();
73
74
        $this->assertFalse($this->container->getParameter('onurb_yuml.show_fields_description'));
75
        $this->assertSame(array(), $this->container->getParameter('onurb_yuml.colors'));
76
        $this->assertSame(array(), $this->container->getParameter('onurb_yuml.notes'));
77
    }
78
79
    public function testPartialConfiguration()
80
    {
81
        $this->container->loadFromExtension($this->extension->getAlias());
82
83
        $this->loadConfiguration($this->container, 'config_partial');
84
        $this->container->compile();
85
86
        $this->assertTrue($this->container->getParameter('onurb_yuml.show_fields_description'));
87
        $this->assertSame(array(), $this->container->getParameter('onurb_yuml.colors'));
88
        $this->assertSame(array(), $this->container->getParameter('onurb_yuml.notes'));
89
        $this->assertSame('png', $this->container->getParameter('onurb_yuml.extension'));
90
        $this->assertSame('plain', $this->container->getParameter('onurb_yuml.style'));
91
    }
92
93
    public function testArrayColorsConfiguration()
94
    {
95
        $this->container->loadFromExtension($this->extension->getAlias());
96
97
        $this->loadConfiguration($this->container, 'config_colors');
98
        $this->container->compile();
99
100
        $this->assertSame(
101
            array(
102
                'My\Class' => 'green',
103
                'My\OtherClass' => 'blue'
104
            ),
105
            $this->container->getParameter('onurb_yuml.colors')
106
        );
107
    }
108
109
    public function testArrayNotesConfiguration()
110
    {
111
        $this->container->loadFromExtension($this->extension->getAlias());
112
113
        $this->loadConfiguration($this->container, 'config_notes');
114
        $this->container->compile();
115
116
        $this->assertSame(
117
            array(
118
                'My\Class' => 'My note',
119
                'My\OtherClass' => 'My other note'
120
            ),
121
            $this->container->getParameter('onurb_yuml.notes')
122
        );
123
    }
124
125
    public function testStyleScruffy()
126
    {
127
        $this->container->loadFromExtension($this->extension->getAlias());
128
129
        $this->loadConfiguration($this->container, 'config_style_scruffy');
130
        $this->container->compile();
131
132
        $this->assertSame(
133
            'scruffy',
134
            $this->container->getParameter('onurb_yuml.style')
135
        );
136
    }
137
138
    public function testExtensionSvg()
139
    {
140
        $this->container->loadFromExtension($this->extension->getAlias());
141
142
        $this->loadConfiguration($this->container, 'config_extension_svg');
143
        $this->container->compile();
144
145
        $this->assertSame(
146
            'svg',
147
            $this->container->getParameter('onurb_yuml.extension')
148
        );
149
    }
150
151
    public function testDirectionLR()
152
    {
153
        $this->container->loadFromExtension($this->extension->getAlias());
154
155
        $this->loadConfiguration($this->container, 'config_direction_LR');
156
        $this->container->compile();
157
158
        $this->assertSame(
159
            'LR',
160
            $this->container->getParameter('onurb_yuml.direction')
161
        );
162
    }
163
164
    public function testScaleTiny()
165
    {
166
        $this->container->loadFromExtension($this->extension->getAlias());
167
168
        $this->loadConfiguration($this->container, 'config_scale_tiny');
169
        $this->container->compile();
170
171
        $this->assertSame(
172
            'tiny',
173
            $this->container->getParameter('onurb_yuml.scale')
174
        );
175
    }
176
}
177