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
|
|
|
|
8
|
|
|
// This test relies on \SimpleSAML_Configuration::setPreLoadedConfig(), which is not available until after 1.15.4 |
9
|
|
|
if (method_exists('SimpleSAML_Configuration', 'setPreLoadedConfig')) { |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Tests for TestConfiguration |
13
|
|
|
*/ |
14
|
|
|
class TestConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase |
15
|
|
|
{ |
16
|
|
|
public function testTestConfiguration() |
17
|
|
|
{ |
18
|
|
|
$serverVars = new DependencyInjection(['SERVER_NAME' => 'localhost']); |
19
|
|
|
$requestVars = new DependencyInjection(['output' => 'travis']); |
20
|
|
|
|
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
|
|
|
|
40
|
|
|
$globalConfig = \SimpleSAML_Configuration::loadFromArray($globalConfig_input); |
41
|
|
|
$authSourceConfig = \SimpleSAML_Configuration::loadFromArray($authSourceConfig_input); |
42
|
|
|
$moduleConfig = \SimpleSAML_Configuration::loadFromArray($moduleConfig_input); |
43
|
|
|
|
44
|
|
|
\SimpleSAML_Configuration::setPreLoadedConfig($globalConfig, 'config.php'); |
|
|
|
|
45
|
|
|
\SimpleSAML_Configuration::setPreLoadedConfig($moduleConfig, 'module_monitor.php'); |
46
|
|
|
\SimpleSAML_Configuration::setPreLoadedConfig($authSourceConfig, 'authsources.php'); |
47
|
|
|
|
48
|
|
|
$testConf = new TestConfiguration($serverVars, $requestVars, $globalConfig, $authSourceConfig, $moduleConfig); |
49
|
|
|
|
50
|
|
|
$this->assertEquals($serverVars, $testConf->getServerVars()); |
51
|
|
|
$this->assertEquals($requestVars, $testConf->getRequestVars()); |
52
|
|
|
|
53
|
|
|
$this->assertEquals($globalConfig, $testConf->getGlobalConfig()); |
54
|
|
|
$this->assertEquals($authSourceConfig, $testConf->getAuthSourceConfig()); |
55
|
|
|
$this->assertEquals($moduleConfig, $testConf->getModuleConfig()); |
56
|
|
|
|
57
|
|
|
$metadataConfig = $testConf->getMetadataConfig(); |
58
|
|
|
$this->assertArrayHasKey('https://engine.surfconext.nl/authentication/idp/metadata', $metadataConfig['saml20-idp-remote']); |
59
|
|
|
|
60
|
|
|
$this->assertNotEmpty($testConf->getAvailableApacheModules()); |
61
|
|
|
$this->assertNotEmpty($testConf->getAvailablePhpModules()); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
} |
66
|
|
|
|
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.