Completed
Branch unittests (a61d5f)
by Ruben
02:26
created

Guzzle5Test   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 6 6 2
A testHasGuzzle5Client() 10 10 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
namespace MovingImage\Bundle\VMProApiBundle\Tests\DependencyInjection\VMProApiExtensionTest;
4
5
use GuzzleHttp\ClientInterface;
6
use MovingImage\Bundle\VMProApiBundle\DependencyInjection\VMProApiExtension;
7
use MovingImage\Bundle\VMProApiBundle\Tests\DependencyInjection\AbstractTestCase;
8
use MovingImage\Client\VMPro\ApiClient\Guzzle5ApiClient;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
11
/**
12
 * Class Guzzle5Test.
13
 *
14
 * @author Ruben Knol <[email protected]>
15
 */
16 View Code Duplication
class Guzzle5Test extends AbstractTestCase
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...
17
{
18
    /**
19
     * Skip this test if Guzzle ^6.0 is installed.
20
     */
21
    public function setUp()
22
    {
23
        if (version_compare(ClientInterface::VERSION, '6.0', '>=')) {
24
            $this->markTestSkipped('Skipping test when Guzzle ~6.0 is installed');
25
        }
26
    }
27
28
    /**
29
     * Assert whether when Guzzle ^5.0 is installed, the right instance
30
     * of the API client is placed in the dependency injection container.
31
     */
32
    public function testHasGuzzle5Client()
33
    {
34
        $container = new ContainerBuilder();
35
        $loader = new VMProApiExtension();
36
        $config = $this->getFullConfig();
37
38
        $loader->load($config, $container);
39
40
        $this->assertInstanceOf(Guzzle5ApiClient::class, $container->get('vmpro_api.client'));
41
    }
42
}
43