1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SimpleSAML\Module\monitor\Test; |
4
|
|
|
|
5
|
|
|
use \SimpleSAML\Module\monitor\TestCase as TestCase; |
6
|
|
|
use \SimpleSAML\Module\monitor\TestData as TestData; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Tests for TestCase\Cert\Data and TestCase\Cert\File |
10
|
|
|
*/ |
11
|
|
|
class TestCertificatesTest extends \PHPUnit_Framework_TestCase |
12
|
|
|
{ |
13
|
|
|
public function testCertData() |
14
|
|
|
{ |
15
|
|
|
$testData = new TestData([ |
16
|
|
|
'category' => 'Test certificate', |
17
|
|
|
'certData' => file_get_contents(dirname(__FILE__) . '/../../files/example.org.crt'), |
18
|
|
|
'certExpirationWarning' => 10, |
19
|
|
|
]); |
20
|
|
|
$certTest = new TestCase\Cert\Data($testData); |
21
|
|
|
|
22
|
|
|
$this->assertEquals($testData, $certTest->getTestData()); |
23
|
|
|
$this->assertEquals('Test certificate', $certTest->getCategory()); |
24
|
|
|
$this->assertEquals('www.surfnet.nl', $certTest->getSubject()); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function testCertFile() |
28
|
|
|
{ |
29
|
|
|
$testData = new TestData([ |
30
|
|
|
'category' => 'Test certificate', |
31
|
|
|
'certFile' => dirname(__FILE__) . '/../../files/example.org.crt', |
32
|
|
|
'certExpirationWarning' => 10, |
33
|
|
|
]); |
34
|
|
|
$certTest = new TestCase\Cert\File($testData); |
35
|
|
|
|
36
|
|
|
$this->assertEquals($testData, $certTest->getTestData()); |
37
|
|
|
$this->assertEquals('Test certificate', $certTest->getCategory()); |
38
|
|
|
$this->assertEquals('www.surfnet.nl', $certTest->getSubject()); |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
|