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

MonitorTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 27
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testMonitor() 0 37 1
1
<?php
2
3
namespace SimpleSAML\Modules\Monitor\Test;
4
5
use \SimpleSAML\Modules\Monitor\DependencyInjection as DependencyInjection;
6
use \SimpleSAML\Modules\Monitor\TestConfiguration as TestConfiguration;
7
use \SimpleSAML\Modules\Monitor\Monitor as Monitor;
8
9
// This test relies on \SimpleSAML_Configuration::setPreLoadedConfig(), which is not available until after 1.15.4
10
if (method_exists('SimpleSAML_Configuration', 'setPreLoadedConfig')) {
11
12
/**
13
 * Tests for Monitor
14
 */
15
class MonitorTest extends \SimpleSAML\Test\Utils\ClearStateTestCase
16
{
17
    public function testMonitor()
18
    {
19
        $_SERVER['REQUEST_URI'] = '/';
20
        $serverVars = new DependencyInjection(['SERVER_NAME' => 'localhost']);
21
        $requestVars = new DependencyInjection(['output' => 'travis']);
22
        $globalConfig_input = [
23
            'enable.saml20-idp' => true,
24
            'enable.shib13-idp' => true,
25
            'enable.adfs-idp' => true,
26
            'enable.wsfed-sp' => true,
27
            'metadata.sources' => [
28
                [
29
                    'type' => 'flatfile',
30
                    'file' => 'modules/monitor/tests/files/saml20-idp-remote.php',
31
                ],
32
            ],
33
            'database.dsn' => 'mysql:host=localhost;dbname=saml',
34
        ];
35
        $authSourceConfig_input = [
36
            'test' => 'travis'
37
        ];
38
        $moduleConfig_input = [
39
            'test' => 'travis'
40
        ];
41
        $globalConfig = \SimpleSAML_Configuration::loadFromArray($globalConfig_input);
42
        $authSourceConfig = \SimpleSAML_Configuration::loadFromArray($authSourceConfig_input);
43
        $moduleConfig = \SimpleSAML_Configuration::loadFromArray($moduleConfig_input);
44
45
        \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

45
        \SimpleSAML_Configuration::/** @scrutinizer ignore-call */ 
46
                                   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...
46
        \SimpleSAML_Configuration::setPreLoadedConfig($moduleConfig, 'module_monitor.php');
47
        \SimpleSAML_Configuration::setPreLoadedConfig($authSourceConfig, 'authsources.php');
48
49
        $testConf = new TestConfiguration($serverVars, $requestVars, $globalConfig, $authSourceConfig, $moduleConfig);
50
        $monitor = new Monitor($testConf);
51
        $this->assertEquals($testConf, $monitor->getTestConfiguration());
52
53
        $monitor->invokeTestSuites();
54
    }
55
}
56
57
}
58