Completed
Push — master ( 299004...4a6aaf )
by Tim
11:08 queued 08:52
created

Configuration::initialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SimpleSAML\Module\monitor\TestSuite;
4
5
use \SimpleSAML\Module\monitor\TestCase as TestCase;
6
7
final class Configuration extends \SimpleSAML\Module\monitor\TestSuiteFactory
8
{
9
    /*
10
     * @return void
11
     */
12
    protected function invokeTestSuite()
13
    {
14
        $configuration = $this->getConfiguration();
15
        $globalConfig = $configuration->getGlobalConfig();
16
17
        // Check Service Communications Certificate
18
        if (\SimpleSAML\Utils\HTTP::isHTTPS()) {
19
            $input = array(
20
                'category' => 'Service Communications Certificate',
21
                'hostname' => $_SERVER['SERVER_NAME'],
22
                'port' => $_SERVER['SERVER_PORT']
23
            );
24
            $testData = new TestData($input);
25
26
            $test = new TestCase\Cert\Remote($this, $testData);
27
            $this->addTest($test);
28
        }
29
30
        // Check metadata signing certificate when available
31
        if ($globalConfig->hasValue('metadata.sign.certificate')) {
32
            $metadataCert = $globalConfig->getString('metadata.sign.certificate');
33
34
            $input = array(
35
                'certFile' => \SimpleSAML\Utils\Config::getCertPath($metadataCert),
36
                'category' => 'Metadata Signing Certificate'
37
            );
38
            $testData = new TestData($input);
39
40
            $test = new TestCase\Cert\File($this, $testData);
41
            $this->addTest($test);
42
        }
43
44
        $tests = $this->getTests();
45
        foreach ($tests as $test)
46
        {
47
            $this->addMessages($test->getMessages());
48
        }
49
50
        $this->calculateState();
51
    }
52
}
53