Completed
Push — master ( 580c08...50e7bb )
by Tobias
26:18 queued 54s
created

HttpClientConfiguratorTest::testAppendPlugin()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 16
Ratio 100 %

Importance

Changes 0
Metric Value
dl 16
loc 16
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 12
nc 1
nop 0
1
<?php
2
3
namespace Happyr\ApiClient\Test;
4
5
use Happyr\ApiClient\HttpClientConfigurator;
6
use Http\Client\Common\Plugin\HeaderAppendPlugin;
7
use Nyholm\NSA;
8
9
final class HttpClientConfiguratorTest extends \PHPUnit_Framework_TestCase
10
{
11 View Code Duplication
    public function testAppendPlugin()
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...
12
    {
13
        $hcc = new HttpClientConfigurator();
14
        $plugin0 = new HeaderAppendPlugin(['plugin0']);
15
16
        $hcc->appendPlugin($plugin0);
17
        $plugins = NSA::getProperty($hcc, 'appendPlugins');
18
        $this->assertCount(1, $plugins);
19
        $this->assertEquals($plugin0, $plugins[0]);
20
21
        $plugin1 = new HeaderAppendPlugin(['plugin1']);
22
        $hcc->appendPlugin($plugin1);
23
        $plugins = NSA::getProperty($hcc, 'appendPlugins');
24
        $this->assertCount(2, $plugins);
25
        $this->assertEquals($plugin1, $plugins[1]);
26
    }
27
28 View Code Duplication
    public function testAppendPluginMultiple()
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...
29
    {
30
        $hcc = new HttpClientConfigurator();
31
        $plugin0 = new HeaderAppendPlugin(['plugin0']);
32
        $plugin1 = new HeaderAppendPlugin(['plugin1']);
33
34
        $hcc->appendPlugin($plugin0, $plugin1);
35
        $plugins = NSA::getProperty($hcc, 'appendPlugins');
36
        $this->assertCount(2, $plugins);
37
        $this->assertEquals($plugin0, $plugins[0]);
38
        $this->assertEquals($plugin1, $plugins[1]);
39
    }
40
41 View Code Duplication
    public function testPrependPlugin()
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...
42
    {
43
        $hcc = new HttpClientConfigurator();
44
        $plugin0 = new HeaderAppendPlugin(['plugin0']);
45
46
        $hcc->prependPlugin($plugin0);
47
        $plugins = NSA::getProperty($hcc, 'prependPlugins');
48
        $this->assertCount(1, $plugins);
49
        $this->assertEquals($plugin0, $plugins[0]);
50
51
        $plugin1 = new HeaderAppendPlugin(['plugin1']);
52
        $hcc->prependPlugin($plugin1);
53
        $plugins = NSA::getProperty($hcc, 'prependPlugins');
54
        $this->assertCount(2, $plugins);
55
        $this->assertEquals($plugin1, $plugins[0]);
56
    }
57
58 View Code Duplication
    public function testPrependPluginMultiple()
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...
59
    {
60
        $hcc = new HttpClientConfigurator();
61
        $plugin0 = new HeaderAppendPlugin(['plugin0']);
62
        $plugin1 = new HeaderAppendPlugin(['plugin1']);
63
64
        $hcc->prependPlugin($plugin0, $plugin1);
65
        $plugins = NSA::getProperty($hcc, 'prependPlugins');
66
        $this->assertCount(2, $plugins);
67
        $this->assertEquals($plugin0, $plugins[0]);
68
        $this->assertEquals($plugin1, $plugins[1]);
69
    }
70
}
71