Passed
Branch monitor-2.5.x (8b654c)
by Tim
01:31
created

Configuration   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A testCertificates() 0 4 1
A invokeTest() 0 12 2
A testDatabase() 0 4 1
1
<?php
2
3
namespace SimpleSAML\Modules\Monitor\TestSuite;
4
5
use \SimpleSAML\Modules\Monitor\TestConfiguration as TestConfiguration;
6
use \SimpleSAML\Modules\Monitor\TestCase as TestCase;
7
use \SimpleSAML\Modules\Monitor\TestData as TestData;
8
use \SimpleSAML\Modules\Monitor\TestResult as TestResult;
9
use \SimpleSAML\Modules\Monitor\State as State;
10
use \SimpleSAML\Utils as Utils;
11
12
final class Configuration extends \SimpleSAML\Modules\Monitor\TestSuiteFactory
13
{
14
    /**
15
     * @param TestConfiguration $configuration
16
     */
17
    public function __construct($configuration)
18
    {
19
        $this->setCategory('Configuration');
20
        parent::__construct($configuration);
21
    }
22
23
    /**
24
     * @return array
25
     */
26
    private function testCertificates($configuration)
27
    {
28
        $test = new Configuration\Certificates($configuration);
29
        return $test->getTestResults();
30
    }
31
32
    /**
33
     * @return array
34
     */
35
    private function testDatabase($configuration)
36
    {
37
        $test = new Configuration\Database($configuration);
38
        return $test->getTestResults();
39
    }
40
41
    /**
42
     * @return void
43
     */
44
    public function invokeTest()
45
    {
46
        $configuration = $this->getConfiguration();
47
        $results = [];
48
49
        $results = array_merge($results, $this->testCertificates($configuration));
50
        $results = array_merge($results, $this->testDatabase($configuration));
51
52
        foreach ($results as $result) {
53
            $this->addTestResult($result);
54
        }
55
        $this->calculateState();
56
    }
57
}
58