diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php index e2a9fdbc1cf29657dba19a436c2a26c361d543f4..28737c58e35e49feec943e59bc7c5ee964fe4090 100644 --- a/lib/SimpleSAML/Configuration.php +++ b/lib/SimpleSAML/Configuration.php @@ -198,7 +198,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState /** - * Load a configuration file from a configuration set. + * Load a configuration file from a configuration set.XM * * @param string $filename The name of the configuration file. * @param string $configSet The configuration set. Optional, defaults to 'simplesaml'. diff --git a/tests/config/no-options/config.php b/tests/config/no-options/config.php deleted file mode 100644 index dddd7364cbd8bb2541b34bde1e9f85aa0fd995f7..0000000000000000000000000000000000000000 --- a/tests/config/no-options/config.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -/* A configuration desigend for tests that need no configuration options set yet the SSP requires a config.php to have -been loaded. -*/ -$config = array( - // We need to set at least one key=value pair to avoid validation issues loading the file - 'some_example_option' => 'a', -); \ No newline at end of file diff --git a/tests/lib/SimpleSAML/ConfigurationTest.php b/tests/lib/SimpleSAML/ConfigurationTest.php index e93e96e2a1a514ac7e1cd5c190c9ad01215f4edc..035c1b0117763a04fde6377cf3b580461f2a82ee 100644 --- a/tests/lib/SimpleSAML/ConfigurationTest.php +++ b/tests/lib/SimpleSAML/ConfigurationTest.php @@ -37,7 +37,10 @@ class Test_SimpleSAML_Configuration extends PHPUnit_Framework_TestCase } catch (\SimpleSAML\Error\CriticalConfigurationError $var) { // This exception is expected. } - //TODO: not sure this is correct. First call to getInstance() throw exception and the 2nd works?... + /* + * After the above failure an emergency configuration is create to allow core SSP components to function and + * possibly log/display the error. + */ $c = SimpleSAML_Configuration::getInstance(); $this->assertNotEmpty($c->toArray()); } @@ -105,8 +108,8 @@ class Test_SimpleSAML_Configuration extends PHPUnit_Framework_TestCase */ public function testGetBaseURL() { - // Need to set a configuration file because the SSP Logger attempts to load it. - putenv('SIMPLESAMLPHP_CONFIG_DIR=tests/config/no-options'); + // Need to set a default configuration because the SSP Logger attempts to use it. + SimpleSAML_Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); $c = SimpleSAML_Configuration::loadFromArray(array()); $this->assertEquals($c->getBaseURL(), 'simplesaml/'); diff --git a/tests/lib/SimpleSAML/Locale/LocalizationTest.php b/tests/lib/SimpleSAML/Locale/LocalizationTest.php index c852d0fce72adcf5fcfd67d0f3b3e2d93a50278a..a8ea072affe88884e1db299fa12b9a88c92890d9 100644 --- a/tests/lib/SimpleSAML/Locale/LocalizationTest.php +++ b/tests/lib/SimpleSAML/Locale/LocalizationTest.php @@ -3,13 +3,15 @@ namespace SimpleSAML\Test\Locale; use SimpleSAML\Locale\Localization; +use \SimpleSAML_Configuration as Configuration; + class LocalizationTest extends \PHPUnit_Framework_TestCase { protected function setUp() { - // Localization/Language code attempts to load a cookie, and looks to config.php for a name of the cookie - putenv('SIMPLESAMLPHP_CONFIG_DIR=tests/config/no-options'); + // Localization/Language code attempts to load a cookie, and looks in the config for a name of the cookie + Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); } diff --git a/tests/lib/SimpleSAML/Utils/XMLTest.php b/tests/lib/SimpleSAML/Utils/XMLTest.php index bd675b760c5682c9f8d71290b889d1f46cf020ce..a812b964f0d8a8a7a83c0835dd95a88b37edca0b 100644 --- a/tests/lib/SimpleSAML/Utils/XMLTest.php +++ b/tests/lib/SimpleSAML/Utils/XMLTest.php @@ -356,6 +356,8 @@ NOWDOC; */ public function testIsValidMetadata() { + \SimpleSAML_Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + $schema = 'saml-schema-metadata-2.0.xsd'; $dom = $this->getMockBuilder('\DOMDocument') diff --git a/tests/modules/consent/lib/Auth/Process/ConsentTest.php b/tests/modules/consent/lib/Auth/Process/ConsentTest.php index cf63fe675d160b84d8dd0b069723eadafa440620..e83659d22e054db22ba453e60a5372ac2af2f56b 100644 --- a/tests/modules/consent/lib/Auth/Process/ConsentTest.php +++ b/tests/modules/consent/lib/Auth/Process/ConsentTest.php @@ -37,9 +37,6 @@ class ConsentTest extends \PHPUnit_Framework_TestCase */ public function testCheckDisable() { - // Consent code path attempts to load metadata, which tries to find a config.php - putenv('SIMPLESAMLPHP_CONFIG_DIR=tests/config/no-options'); - // test consent disable regex with match $config = array(); diff --git a/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php b/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php index b9b07c3c96ea9ae12a799211e3f07fc06eb6e8c6..bb3d065db979d757aa9a474c55706ade050578c3 100644 --- a/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php +++ b/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php @@ -125,7 +125,6 @@ class SP_Test extends \PHPUnit_Framework_TestCase ); $this->config = Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); - }