Passed
Pull Request — master (#9)
by Tim
02:22
created

TestCertificatesTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCertData() 0 12 1
A testCertFile() 0 12 1
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