RedirectTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 59.26 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 3
dl 16
loc 27
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
    public function setUp()
21
    {
22
        $this->ComodoDecodeCSR = new ComodoDecodeCSR();
23
    }
24
25 View Code Duplication
    public function test301Redirect()
26
    {
27
        $stream = Psr7\stream_for('{"data" : "test"}');
28
        $response = new Response(301, ['Location' => 'https://comododecodecsr.tk'], $stream);
29
30
        $test = $this->ComodoDecodeCSR->checkDVC($response);
31
        $this->assertFalse($test, "Failed to check 301 redirect");
32
    }
33
34 View Code Duplication
    public function test302Redirect()
35
    {
36
        $stream = Psr7\stream_for('{"data" : "test"}');
37
        $response = new Response(302, ['Location' => 'https://comododecodecsr.tk'], $stream);
38
39
        $test = $this->ComodoDecodeCSR->checkDVC($response);
40
        $this->assertFalse($test, "Failed to check 302 redirect");
41
    }
42
}
43