Completed
Push — wip-platform ( 03cba6...2999ab )
by
unknown
05:53 queued 02:49
created

BlastCoreBundleTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 100 %

Coupling/Cohesion

Components 2
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 2
cbo 3
dl 38
loc 38
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 7 7 1
A testServicesAreInitializable() 12 12 2
A testServicesExists() 12 12 1

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
/*
4
 *
5
 * Copyright (C) 2015-2017 Libre Informatique
6
 *
7
 * This file is licenced under the GNU LGPL v3.
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Blast\Bundle\CoreBundle\Tests\Functional;
13
14
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
15
use Symfony\Component\DependencyInjection\Container;
16
17 View Code Duplication
class BlastCoreBundleTest extends KernelTestCase
0 ignored issues
show
Duplication introduced by
This class 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...
Duplication introduced by
This class 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...
18
{
19
    protected $container;
20
21
    protected function setUp()
22
    {
23
        static::bootKernel();
24
25
        /* @var Container $container */
26
        $this->container = self::$kernel->getContainer();
27
    }
28
29
    public function testServicesAreInitializable()
30
    {
31
        $serviceIds = array_filter($this->container->getServiceIds(), function ($serviceId) {
32
            return 0 === strpos($serviceId, 'blast_core.');
33
        });
34
35
        foreach ($serviceIds as $serviceId) {
36
            $this->assertNotNull($this->container->get($serviceId));
37
        }
38
39
        $this->assertContains('blast_core.form.type.entity_code', $serviceIds);
40
    }
41
42
    public function testServicesExists()
43
    {
44
        /*
45
         * @todo is it usefull to test if service exist or not
46
         */
47
48
        $this->assertContains('blast_core.code_generator_factory', $this->container->getServiceIds());
49
50
        $this->assertContains('blast_core.code_generators', $this->container->getServiceIds());
51
        $this->assertContains('blast_core.form.type.entity_code', $this->container->getServiceIds());
52
        //$this->assertContains('blast_core.label.strategy.blast', $this->container->getServiceIds());
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
53
    }
54
}
55