Passed
Push — master ( bb5c60...87d27f )
by Tim
01:35
created

Sql::invokeTest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 16
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
namespace SimpleSAML\Modules\Monitor\TestSuite\Store;
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;
0 ignored issues
show
Bug introduced by
The type SimpleSAML\Modules\Monitor\State was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
11
final class Sql extends \SimpleSAML\Modules\Monitor\TestSuiteFactory
12
{
13
    /**
14
     * var string
15
     */
16
    private $host;
17
18
    /**
19
     * @param TestConfiguration $configuration
20
     */
21
    public function __construct($configuration)
22
    {
23
        $globalConfig = $configuration->getGlobalConfig();
24
        $this->host = $globalConfig->getString('store.sql.dsn');
25
26
        parent::__construct($configuration);
27
    }
28
29
    /**
30
     * @return void
31
     */
32
    public function invokeTest()
33
    {
34
        $testResult = new TestResult('SQL', 'Overall health');
35
36
        $input = array(
37
            'host' => $this->host,
38
        );
39
        $testData = new TestData($input);
40
        $test = new TestCase\Store\Sql($testData);
41
42
        $sqlResult = $test->getTestResult();
43
        $this->addTestResult($sqlResult);
44
45
        $state = $this->calculateState();
46
        $testResult->setState($state);
47
        $this->setTestResult($testResult);
48
    }
49
}
50