Completed
Push — refonte ( 7173e3...bffa4c )
by Arnaud
02:33
created

ConfigurationTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 24
loc 24
rs 10
c 0
b 0
f 0

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace LAG\AdminBundle\Tests\DependencyInjection;
4
5
use LAG\AdminBundle\DependencyInjection\Configuration;
6
use LAG\AdminBundle\Tests\AdminTestBase;
7
use Symfony\Component\Config\Definition\ArrayNode;
8
9
class ConfigurationTest extends AdminTestBase
10
{
11
    /**
12
     * GetConfigTreeBuilder method should a return valid array nodes. The configuration is more tested in
13
     * LagAdminExtensionTest.
14
     */
15
    public function testGetConfigTreeBuilder()
16
    {
17
        $configuration = new Configuration();
18
        $tree = $configuration->getConfigTreeBuilder();
19
        /** @var ArrayNode $arrayNode */
20
        $arrayNode = $tree->buildTree();
21
        $this->assertInstanceOf(ArrayNode::class, $arrayNode);
22
23
        $arrayConfiguration = $arrayNode->getChildren();
24
25
        $this->assertArrayHasKey('application', $arrayConfiguration);
26
        $this->assertInstanceOf(ArrayNode::class, $arrayNode->getChildren()['application']);
27
        $this->assertArrayHasKey('admins', $arrayConfiguration);
28
        $this->assertInstanceOf(ArrayNode::class, $arrayNode->getChildren()['admins']);
29
        $this->assertArrayHasKey('menus', $arrayConfiguration);
30
        $this->assertInstanceOf(ArrayNode::class, $arrayNode->getChildren()['menus']);
31
    }
32
}
33