|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SimpleSAML\Module\monitor\Test; |
|
4
|
|
|
|
|
5
|
|
|
use \SimpleSAML\Module\monitor\TestConfiguration as TestConfiguration; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Tests for TestConfiguration |
|
9
|
|
|
*/ |
|
10
|
|
|
class TestConfigurationTest extends \PHPUnit_Framework_TestCase |
|
11
|
|
|
{ |
|
12
|
|
|
public function testTestConfiguration() |
|
13
|
|
|
{ |
|
14
|
|
|
$serverVars = ['SERVER_NAME' => 'localhost']; |
|
15
|
|
|
$requestVars = ['output' => 'travis']; |
|
16
|
|
|
|
|
17
|
|
|
$globalConfig_input = ['enable.saml20-idp' => true, 'metadata.sources' => [['type' => 'xml', 'file' => 'modules/monitor/tests/files/metadata.xml']]]; |
|
18
|
|
|
$authSourceConfig_input = ['test' => 'travis']; |
|
19
|
|
|
$moduleConfig_input = ['test' => 'travis']; |
|
20
|
|
|
|
|
21
|
|
|
$globalConfig = \SimpleSAML_Configuration::loadFromArray($globalConfig_input); |
|
22
|
|
|
$authSourceConfig = \SimpleSAML_Configuration::loadFromArray($authSourceConfig_input); |
|
23
|
|
|
$moduleConfig = \SimpleSAML_Configuration::loadFromArray($moduleConfig_input); |
|
24
|
|
|
|
|
25
|
|
|
$testConf = new TestConfiguration($serverVars, $requestVars, $globalConfig, $authSourceConfig, $moduleConfig); |
|
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
$this->assertEquals($serverVars, $testConf->getServerVars()); |
|
28
|
|
|
$this->assertEquals($requestVars, $testConf->getRequestVars()); |
|
29
|
|
|
|
|
30
|
|
|
$this->assertEquals($globalConfig, $testConf->getGlobalConfig()); |
|
31
|
|
|
$this->assertEquals($authSourceConfig, $testConf->getAuthSourceConfig()); |
|
32
|
|
|
$this->assertEquals($moduleConfig, $testConf->getModuleConfig()); |
|
33
|
|
|
|
|
34
|
|
|
$metadataConfig = $testConf->getMetadataConfig(); |
|
35
|
|
|
$this->assertArrayHasKey('https://engine.surfconext.nl/authentication/idp/metadata', $metadataConfig['saml20-idp-remote']); |
|
36
|
|
|
|
|
37
|
|
|
print_r($testConf->getAvailableApacheModules()); |
|
38
|
|
|
print_r($testConf->getAvailablePhpModules()); |
|
39
|
|
|
} |
|
40
|
|
|
} |
|
41
|
|
|
|