Passed
Push — master ( 0cbe9b...ce249c )
by Tim
03:51
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.4285
c 0
b 0
f 0
1
<?php
2
3
namespace SimpleSAML\Module\monitor\TestSuite\Store;
4
5
use \SimpleSAML\Module\monitor\TestConfiguration as TestConfiguration;
6
use \SimpleSAML\Module\monitor\TestCase as TestCase;
7
use \SimpleSAML\Module\monitor\TestData as TestData;
8
use \SimpleSAML\Module\monitor\TestResult as TestResult;
9
use \SimpleSAML\Module\monitor\State as State;
10
11
final class Sql extends \SimpleSAML\Module\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
27
    /**
28
     * @return void
29
     */
30
    public function invokeTest()
31
    {
32
        $testResult = new TestResult('SQL', 'Overall health');
33
34
        $input = array(
35
            'host' => $this->host,
36
        );
37
        $testData = new TestData($input);
38
        new TestCase\Store\Sql($testData);
0 ignored issues
show
Bug introduced by
The type SimpleSAML\Module\monitor\TestCase\Store\Sql 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...
39
40
        $sqlResult = $test->getTestResult();
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $test seems to be never defined.
Loading history...
41
        $this->addTestResult($sqlResult);
42
43
        $state = $this->calculateState();
44
        $testResult->setState($state);
45
        $this->setTestResult($testResult);
46
    }
47
}
48