Completed
Push — master ( 432186...3af16c )
by Chris
04:32 queued 01:29
created

ComodoDecodeCSRTest::testCheckingInstalled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
ccs 7
cts 7
cp 1
rs 9.6666
cc 1
eloc 6
nc 1
nop 0
crap 1
1
<?php
2
/**
3
* @author Chris Hilsdon <[email protected]>
4
*/
5
namespace Xigen\Tests;
6
7
use Xigen\ComodoDecodeCSR;
8
9
class ComodoDecodeCSRTest extends XigenUnit
10
{
11
    private $validMD5 = "98EB197EF83F7A9EB736ED7CEBD413CE";
12
    private $validSHA1 = "DA9C72B6F6BCB05772BF8543E19D1A41B0210E84";
13
14 3
    public function setUp()
15
    {
16 3
        $this->ComodoDecodeCSR = new ComodoDecodeCSR();
17 3
    }
18
19 1
    public function testSettingCSR()
20
    {
21
        //Load the test CSR
22 1
        $csr = $this->loadTestCSR();
23 1
        $this->ComodoDecodeCSR->setCSR($csr);
24 1
        $this->assertSame(
25 1
            $csr,
26 1
            $this->ComodoDecodeCSR->getCSR(),
27
            "Unable to set the CSR via ->setCSR()"
28 1
        );
29 1
    }
30
31 2
    public function testGettingHashes()
32
    {
33 1
        $csr = $this->loadTestCSR();
34 1
        $this->ComodoDecodeCSR->setCSR($csr);
35 1
        $Hashes = $this->ComodoDecodeCSR->fetchHashes();
36
37 1
        $this->assertSame($this->validMD5, $Hashes["md5"], "md5 didn't match the correct value");
38 1
        $this->assertSame($this->validSHA1, $Hashes["sha1"], "sha1 didn't match the correct value");
39 2
    }
40
41 1
    public function testCheckingInstalled()
42
    {
43 1
        $csr = $this->loadTestCSR();
44 1
        $this->ComodoDecodeCSR->setCSR($csr);
45 1
        $Hashes = $this->ComodoDecodeCSR->fetchHashes();
0 ignored issues
show
Unused Code introduced by
$Hashes is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
46 1
        $Installed = $this->ComodoDecodeCSR->checkInstalled();
47
48 1
        $this->assertTrue($Installed);
49 1
    }
50
}
51