Completed
Push — master ( 74a36c...b50a3c )
by Chris
03:40 queued 57s
created

ComodoDecodeCSRTest::testGettingHashes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
rs 9.6666
cc 1
eloc 6
nc 1
nop 0
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 = "244A9E11A76D297F0816A92F477DF543";
12
    private $validSHA1 = "8FC930D6EDE2844D9DA147F9928178AEFB5B7E89";
13
14
    public function setUp()
15
    {
16
        $this->ComodoDecodeCSR = new ComodoDecodeCSR();
1 ignored issue
show
Bug introduced by
The property ComodoDecodeCSR does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
17
    }
18
19
    public function testSettingCSR()
20
    {
21
        //Load the test CSR
22
        $csr = $this->loadTestCSR();
23
        $this->ComodoDecodeCSR->setCSR($csr);
24
        $this->assertSame(
25
            $csr,
26
            $this->ComodoDecodeCSR->getCSR(),
27
            "Unable to set the CSR via ->setCSR()"
28
        );
29
    }
30
31
    public function testGettingHashes()
32
    {
33
        $csr = $this->loadTestCSR();
34
        $this->ComodoDecodeCSR->setCSR($csr);
35
        $Hashes = $this->ComodoDecodeCSR->getHashes();
36
37
        $this->assertSame($this->validMD5, $Hashes["md5"], "md5 didn't match the correct value");
38
        $this->assertSame($this->validSHA1, $Hashes["sha1"], "sha1 didn't match the correct value");
39
    }
40
}
41