Passed
Push — master ( a49cca...4f5ea1 )
by Tim
01:47
created

MonitorTest::testMonitor()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 35
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 24
nc 1
nop 0
dl 0
loc 35
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
namespace SimpleSAML\Module\monitor\Test;
4
5
use \SimpleSAML\Module\monitor\DependencyInjection as DependencyInjection;
6
use \SimpleSAML\Module\monitor\TestConfiguration as TestConfiguration;
7
use \SimpleSAML\Module\monitor\Monitor as Monitor;
8
9
// This test relies on \SimpleSAML_Configuration::setPreLoadedConfig(), which is not available until after 1.15.4
10
if (\SimpleSAML_Configuration::getVersion() === "master" || version_compare(\SimpleSAML_Configuration::getVersion(), '1.15.4', '>')) {
0 ignored issues
show
Bug Best Practice introduced by
The method SimpleSAML_Configuration::getVersion() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

10
if (\SimpleSAML_Configuration::/** @scrutinizer ignore-call */ getVersion() === "master" || version_compare(\SimpleSAML_Configuration::getVersion(), '1.15.4', '>')) {
Loading history...
11
12
/**
13
 * Tests for Monitor
14
 */
15
class MonitorTest extends \SimpleSAML\Test\Utils\ClearStateTestCase
16
{
17
    public function testMonitor()
18
    {
19
        $serverVars = new DependencyInjection(['SERVER_NAME' => 'localhost']);
20
        $requestVars = new DependencyInjection(['output' => 'travis']);
21
        $globalConfig_input = [
22
            'enable.saml20-idp' => true,
23
            'enable.shib13-idp' => true,
24
            'enable.adfs-idp' => true,
25
            'enable.wsfed-sp' => true,
26
            'metadata.sources' => [
27
                [
28
                    'type' => 'xml',
29
                    'file' => 'modules/monitor/tests/files/metadata.xml',
30
                ],
31
            ],
32
        ];
33
        $authSourceConfig_input = [
34
            'test' => 'travis'
35
        ];
36
        $moduleConfig_input = [
37
            'test' => 'travis'
38
        ];
39
        $globalConfig = \SimpleSAML_Configuration::loadFromArray($globalConfig_input);
40
        $authSourceConfig = \SimpleSAML_Configuration::loadFromArray($authSourceConfig_input);
41
        $moduleConfig = \SimpleSAML_Configuration::loadFromArray($moduleConfig_input);
42
43
        \SimpleSAML_Configuration::setPreLoadedConfig($globalConfig, 'config.php');
0 ignored issues
show
Bug introduced by
The method setPreLoadedConfig() does not exist on SimpleSAML_Configuration. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

43
        \SimpleSAML_Configuration::/** @scrutinizer ignore-call */ 
44
                                   setPreLoadedConfig($globalConfig, 'config.php');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
44
        \SimpleSAML_Configuration::setPreLoadedConfig($moduleConfig, 'module_monitor.php');
45
        \SimpleSAML_Configuration::setPreLoadedConfig($authSourceConfig, 'authsources.php');
46
47
        $testConf = new TestConfiguration($serverVars, $requestVars, $globalConfig, $authSourceConfig, $moduleConfig);
48
        $monitor = new Monitor($testConf);
49
        $this->assertEquals($testConf, $monitor->getTestConfiguration());
50
51
        $monitor->invokeTestSuites();
52
    }
53
}
54
55
}
56