Completed
Push — develop ( 146f3e...4146c2 )
by Chris
03:08
created

RedirectTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 59.26 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 3
dl 16
loc 27
ccs 15
cts 15
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A test301Redirect() 8 8 1
A test302Redirect() 8 8 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
 * @author     Chris Hilsdon <[email protected]>
4
 * @package    ComodoDecodeCSR
5
 * @copyright  2016 Xigen
6
 * @license    GNU General Public License v3
7
 * @link       https://github.com/XigenChris/ComodoDecodeCSR
8
 */
9
10
namespace Xigen\Tests;
11
12
use GuzzleHttp\Psr7;
13
use GuzzleHttp\Psr7\Response;
14
use Xigen\ComodoDecodeCSR;
15
16
class RedirectTest extends XigenUnit
17
{
18
    protected $ComodoDecodeCSR;
19
20 2
    public function setUp()
21
    {
22 2
        $this->ComodoDecodeCSR = new ComodoDecodeCSR();
23 2
    }
24
25 1 View Code Duplication
    public function test301Redirect()
1 ignored issue
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...
26
    {
27 1
        $stream = Psr7\stream_for('{"data" : "test"}');
28 1
        $response = new Response(301, ['Location' => 'https://comododecodecsr.tk'], $stream);
29
30 1
        $test = $this->ComodoDecodeCSR->checkDVC($response);
31 1
        $this->assertFalse($test, "Failed to check 301 redirect");
32 1
    }
33
34 1 View Code Duplication
    public function test302Redirect()
1 ignored issue
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...
35
    {
36 1
        $stream = Psr7\stream_for('{"data" : "test"}');
37 1
        $response = new Response(302, ['Location' => 'https://comododecodecsr.tk'], $stream);
38
39 1
        $test = $this->ComodoDecodeCSR->checkDVC($response);
40 1
        $this->assertFalse($test, "Failed to check 302 redirect");
41 1
    }
42
}
43