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
|
6 |
|
public function setUp() |
20
|
|
|
{ |
21
|
6 |
|
$this->ComodoDecodeCSR = new ComodoDecodeCSR(); |
22
|
6 |
|
$this->ComodoDecodeCSR->setCSR($this->loadTestCSR()); |
23
|
6 |
|
$this->Hashes = $this->ComodoDecodeCSR->fetchHashes(); |
24
|
6 |
|
} |
25
|
|
|
|
26
|
6 |
|
private function checkresponse($response) |
27
|
|
|
{ |
28
|
6 |
|
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() |
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() |
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
|
1 |
|
public function testWithSH1AndComdoTextAndNewLine() |
69
|
|
|
{ |
70
|
1 |
|
$response = $this->validSHA1 . "\n"; |
71
|
1 |
|
$response .= "comodoca.com\n\n"; |
72
|
1 |
|
$test = $this->checkresponse($response); |
73
|
1 |
|
$this->assertTrue($test); |
74
|
1 |
|
} |
75
|
|
|
} |
76
|
|
|
|