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', '>')) { |
|
|
|
|
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'); |
|
|
|
|
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
|
|
|
|