Completed
Push — master ( facf10...129baf )
by Chris
02:33
created

DiffrentTextfileCSRTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 54
Duplicated Lines 25.93 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 7
c 2
b 0
f 1
lcom 1
cbo 2
dl 14
loc 54
ccs 34
cts 34
cp 1
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A checkresponse() 0 4 1
A testWithEmptyresponse() 0 6 1
A testWithTrailingReturn() 0 6 1
A testWithJustSH1() 0 6 1
A testWithSH1AndComdoText() 7 7 1
A testWithSH1AndComdoTextNoTrailingReturn() 7 7 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 Xigen\ComodoDecodeCSR;
13
14
class DiffrentTextfileCSRTest extends XigenUnit
15
{
16
    protected $ComodoDecodeCSR;
17
    protected $Hashes;
18
19 5
    public function setUp()
20
    {
21 5
        $this->ComodoDecodeCSR = new ComodoDecodeCSR();
22 5
        $this->ComodoDecodeCSR->setCSR($this->loadTestCSR());
23 5
        $this->Hashes = $this->ComodoDecodeCSR->fetchHashes();
24 5
    }
25
26 5
    private function checkresponse($response)
27
    {
28 5
        return $this->ComodoDecodeCSR->checkDVC($response);
29
    }
30
31 1
    public function testWithEmptyresponse()
32
    {
33 1
        $response = "";
34 1
        $test = $this->checkresponse($response);
35 1
        $this->assertFalse($test);
36 1
    }
37
38 1
    public function testWithTrailingReturn()
39
    {
40 1
        $response = "\n";
41 1
        $test = $this->checkresponse($response);
42 1
        $this->assertFalse($test);
43 1
    }
44
45 1
    public function testWithJustSH1()
46
    {
47 1
        $response = $this->validSHA1 . "\n";
48 1
        $test = $this->checkresponse($response);
49 1
        $this->assertFalse($test);
50 1
    }
51
52 1 View Code Duplication
    public function testWithSH1AndComdoText()
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...
53
    {
54 1
        $response = $this->validSHA1 . "\n";
55 1
        $response .= "comodoca.com\n";
56 1
        $test = $this->checkresponse($response);
57 1
        $this->assertTrue($test);
58 1
    }
59
60 1 View Code Duplication
    public function testWithSH1AndComdoTextNoTrailingReturn()
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...
61
    {
62 1
        $response = $this->validSHA1 . "\n";
63 1
        $response .= "comodoca.com";
64 1
        $test = $this->checkresponse($response);
65 1
        $this->assertTrue($test);
66 1
    }
67
}
68