diff --git a/tests/BuiltInServer.php b/tests/BuiltInServer.php index a121b20d091c8d5b77713a20c62538c262f834dd..1937ca9281661b9b9e03fd89895cb5abe54fe374 100644 --- a/tests/BuiltInServer.php +++ b/tests/BuiltInServer.php @@ -13,7 +13,6 @@ use SimpleSAML\Utils\System; class BuiltInServer { - /** * The PID of the running server. * diff --git a/tests/SigningTestCase.php b/tests/SigningTestCase.php index 1c48310d17335db8a0c709cd5b07c4383695d923..5bf95a4566b53df230db70e2605806d9066c4933 100644 --- a/tests/SigningTestCase.php +++ b/tests/SigningTestCase.php @@ -9,6 +9,7 @@ namespace SimpleSAML\Test; use PHPUnit\Framework\TestCase; +use SimpleSAML\Configuration; use \org\bovigo\vfs\vfsStream; class SigningTestCase extends TestCase @@ -142,6 +143,9 @@ NOWDOC; const GOOD_CERTIFICATE = 'good.cert.pem'; + /** + * @return array + */ public function getCertDirContent() { return [ @@ -153,6 +157,9 @@ NOWDOC; } + /** + * @return void + */ public function setUp() { $this->root = vfsStream::setup( @@ -176,13 +183,22 @@ NOWDOC; } + /** + * @return void + */ public function tearDown() { $this->clearInstance($this->config, '\SimpleSAML\Configuration', []); } - protected function clearInstance($service, $className, $value = null) + /** + * @param \SimpleSAML\Configuration $service + * @param string $className + * @param mixed|null $value + * @return void + */ + protected function clearInstance(Configuration $service, $className, $value = null) { $reflectedClass = new \ReflectionClass($className); $reflectedInstance = $reflectedClass->getProperty('instance'); diff --git a/tests/Utils/ClearStateTestCase.php b/tests/Utils/ClearStateTestCase.php index d7d11c8919b324b830c0b68421bc755c447703d5..fc713731ceb59e5e8f93aa74249a160fb53f0c14 100644 --- a/tests/Utils/ClearStateTestCase.php +++ b/tests/Utils/ClearStateTestCase.php @@ -17,6 +17,10 @@ class ClearStateTestCase extends TestCase */ protected static $stateClearer; + + /** + * @return void + */ public static function setUpBeforeClass() { if (!self::$stateClearer) { @@ -26,11 +30,18 @@ class ClearStateTestCase extends TestCase } + /** + * @return void + */ protected function setUp() { self::clearState(); } + + /** + * @return void + */ public static function tearDownAfterClass() { self::clearState(); @@ -39,6 +50,7 @@ class ClearStateTestCase extends TestCase /** * Clear any SSP global state to reduce spill over between tests. + * @return void */ public static function clearState() { diff --git a/tests/Utils/ReduceSpillOverTest.php b/tests/Utils/ReduceSpillOverTest.php index c744e2a5fda3cfdb43249715a709f06527ff1a81..c29360b7b4938fb60ad4eb9c129ab22e22c2423a 100644 --- a/tests/Utils/ReduceSpillOverTest.php +++ b/tests/Utils/ReduceSpillOverTest.php @@ -8,9 +8,9 @@ namespace SimpleSAML\Test\Utils; */ class ReduceSpillOverTest extends ClearStateTestCase { - /** * Set some global state + * @return void */ public function testSetState() { @@ -20,8 +20,11 @@ class ReduceSpillOverTest extends ClearStateTestCase putenv('SIMPLESAMLPHP_CONFIG_DIR='.__DIR__); } + /** * Confirm global state removed prior to next test + * @return void + * @throws \SimpleSAML\Error\ConfigurationError */ public function testStateRemoved() { diff --git a/tests/Utils/StateClearer.php b/tests/Utils/StateClearer.php index 9472ef1993e6b18f675d8cd72df420b99b608edd..56412bcf5cdc9273afd914171e2d0163b941d27a 100644 --- a/tests/Utils/StateClearer.php +++ b/tests/Utils/StateClearer.php @@ -7,7 +7,6 @@ namespace SimpleSAML\Test\Utils; */ class StateClearer { - /** * Global state to restore between test runs * @var array @@ -26,6 +25,10 @@ class StateClearer */ private $vars_to_unset = ['SIMPLESAMLPHP_CONFIG_DIR']; + + /** + * @return void + */ public function backupGlobals() { // Backup any state that is needed as part of processing, so we can restore it later. @@ -43,6 +46,7 @@ class StateClearer /** * Clear any global state. + * @return void */ public function clearGlobals() { @@ -60,12 +64,13 @@ class StateClearer } } + /** * Clear any SSP specific state, such as SSP enviormental variables or cached internals. + * @return void */ public function clearSSPState() { - foreach ($this->clearableState as $var) { $var::clearInternalState(); } diff --git a/tests/_autoload_modules.php b/tests/_autoload_modules.php index 4819d743aa931b2cf30b14e64b41c8d022d84514..8b1da33e75d710431af4e35ba0330a62b7aa32df 100644 --- a/tests/_autoload_modules.php +++ b/tests/_autoload_modules.php @@ -8,6 +8,7 @@ * Module test classes have namespaces like SimpleSAML\Test\Module\<moduleName>\Auth\Process * * @param string $className Name of the class. + * @return void */ function sspmodTestClassAutoloadPSR4($className) { diff --git a/tests/lib/AutoloadModulesTest.php b/tests/lib/AutoloadModulesTest.php index 4520b9e618a3136951b8ec46c3dcf716a71ef002..c136ea5ea6366904a7dfc59ec873e673a176da9c 100644 --- a/tests/lib/AutoloadModulesTest.php +++ b/tests/lib/AutoloadModulesTest.php @@ -9,6 +9,7 @@ class AutoloadModulesTest extends TestCase { /** * Set up for each test. + * @return void */ protected function setUp() { @@ -19,6 +20,7 @@ class AutoloadModulesTest extends TestCase /** * @test * @runInSeparateProcess + * @return void */ public function autoloaderDoesNotRecurseInfinitely() { @@ -27,6 +29,7 @@ class AutoloadModulesTest extends TestCase /** * @test + * @return void */ public function autoloaderSubstitutesNamespacedXmlSecClassesWhereNonNamespacedClassWasUsed() { diff --git a/tests/lib/SimpleSAML/Auth/SimpleTest.php b/tests/lib/SimpleSAML/Auth/SimpleTest.php index 7d667ab46269eb822fce4cb56e1bb8969030912a..7e5799634165577e75e7d482ffd1311fe9503aa6 100644 --- a/tests/lib/SimpleSAML/Auth/SimpleTest.php +++ b/tests/lib/SimpleSAML/Auth/SimpleTest.php @@ -10,6 +10,7 @@ class SimpleTest extends \SimpleSAML\Test\Utils\ClearStateTestCase { /** * @test + * @return void */ public function testGetProcessedURL() { diff --git a/tests/lib/SimpleSAML/Auth/SourceTest.php b/tests/lib/SimpleSAML/Auth/SourceTest.php index e51781d72d6392c98eff242d00a2a2c630b0e7b4..57585ec8346882ee44aec1b12d6a2d01656fe986 100644 --- a/tests/lib/SimpleSAML/Auth/SourceTest.php +++ b/tests/lib/SimpleSAML/Auth/SourceTest.php @@ -8,9 +8,11 @@ use SimpleSAML\Test\Utils\ClearStateTestCase; /** * Tests for \SimpleSAML\Auth\Source */ - class SourceTest extends ClearStateTestCase { + /** + * @return void + */ public function testParseAuthSource() { $class = new \ReflectionClass('\SimpleSAML\Auth\Source'); @@ -29,6 +31,9 @@ class SourceTest extends ClearStateTestCase class TestAuthSource extends \SimpleSAML\Auth\Source { + /** + * @return void + */ public function authenticate(&$state) { } @@ -36,6 +41,9 @@ class TestAuthSource extends \SimpleSAML\Auth\Source class TestAuthSourceFactory implements SourceFactory { + /** + * @return \SimpleSAML\Test\Auth\TestAuthSource + */ public function create(array $info, array $config) { return new TestAuthSource($info, $config); diff --git a/tests/lib/SimpleSAML/Auth/StateTest.php b/tests/lib/SimpleSAML/Auth/StateTest.php index cb78b81197a5fa0f349b202b17db90a152631a5f..38d8058621aeabd887ec679548f28d23c857b9d3 100644 --- a/tests/lib/SimpleSAML/Auth/StateTest.php +++ b/tests/lib/SimpleSAML/Auth/StateTest.php @@ -11,6 +11,7 @@ class StateTest extends TestCase { /** * Test the getPersistentAuthData() function. + * @return void */ public function testGetPersistentAuthData() { diff --git a/tests/lib/SimpleSAML/Auth/TimeLimitedTokenTest.php b/tests/lib/SimpleSAML/Auth/TimeLimitedTokenTest.php index 710d3c2d3d53ac382516caf0e1d5f765513e569e..ec7891f449c07e8bf8c3308bc56e0630ea493cf3 100644 --- a/tests/lib/SimpleSAML/Auth/TimeLimitedTokenTest.php +++ b/tests/lib/SimpleSAML/Auth/TimeLimitedTokenTest.php @@ -8,6 +8,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase { /** * Test for malformed tokens. + * @return void */ public function testMalformedToken() { @@ -22,6 +23,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase /** * Basic test to see if validation works for valid tokens. + * @return void */ public function testValidToken() { @@ -35,6 +37,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase /** * Test that token validation takes the verification data into account. + * @return void */ public function testValidTokenWithData() { @@ -52,6 +55,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase /** * Test that expired tokens are rejected. + * @return void */ public function testExpiredToken() { @@ -64,6 +68,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase /** * Test that a token that has been manipulated to extend its validity is rejected. + * @return void */ public function testManipulatedToken() { diff --git a/tests/lib/SimpleSAML/ConfigurationTest.php b/tests/lib/SimpleSAML/ConfigurationTest.php index 6b5d507bf36f8f96374a1e239a97297da818e972..0fde35e9f0addfa8a7308c5787763a44a46b396d 100644 --- a/tests/lib/SimpleSAML/ConfigurationTest.php +++ b/tests/lib/SimpleSAML/ConfigurationTest.php @@ -12,6 +12,7 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase { /** * Test \SimpleSAML\Configuration::getVersion() + * @return void */ public function testGetVersion() { @@ -19,8 +20,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertTrue(is_string($c->getVersion())); } + /** * Test that the default instance fails to load even if we previously loaded another instance. + * @return void */ public function testLoadDefaultInstance() { @@ -33,6 +36,7 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase /** * Test that after a \SimpleSAML\Error\CriticalConfigurationError exception, a basic, self-survival configuration * is loaded. + * @return void */ public function testCriticalConfigurationError() { @@ -50,8 +54,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertNotEmpty($c->toArray()); } + /** * Test \SimpleSAML\Configuration::getValue() + * @return void */ public function testGetValue() { @@ -69,8 +75,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getValue('exists_null', false), null); } + /** * Test \SimpleSAML\Configuration::getValue(), REQUIRED_OPTION flag. + * @return void */ public function testGetValueRequired() { @@ -79,8 +87,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getValue('missing', Configuration::REQUIRED_OPTION); } + /** * Test \SimpleSAML\Configuration::hasValue() + * @return void */ public function testHasValue() { @@ -93,8 +103,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->hasValue('exists_null'), true); } + /** * Test \SimpleSAML\Configuration::hasValue() + * @return void */ public function testHasValueOneOf() { @@ -112,8 +124,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->hasValueOneOf(['missing', 'exists_true']), true); } + /** * Test \SimpleSAML\Configuration::getBasePath() + * @return void */ public function testGetBasePath() { @@ -169,8 +183,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getBasePath(), '/'); } + /** * Test \SimpleSAML\Configuration::resolvePath() + * @return void */ public function testResolvePath() { @@ -189,8 +205,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->resolvePath('C:/otherdir'), 'C:/otherdir'); } + /** * Test \SimpleSAML\Configuration::getPathValue() + * @return void */ public function testGetPathValue() { @@ -205,8 +223,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getPathValue('slashes_opt'), '/basedir/slashes/'); } + /** * Test \SimpleSAML\Configuration::getBaseDir() + * @return void */ public function testGetBaseDir() { @@ -224,8 +244,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getBaseDir(), DIRECTORY_SEPARATOR.'basedir'.DIRECTORY_SEPARATOR); } + /** * Test \SimpleSAML\Configuration::getBoolean() + * @return void */ public function testGetBoolean() { @@ -238,8 +260,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getBoolean('false_opt', '--missing--'), false); } + /** * Test \SimpleSAML\Configuration::getBoolean() missing option + * @return void */ public function testGetBooleanMissing() { @@ -248,8 +272,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getBoolean('missing_opt'); } + /** * Test \SimpleSAML\Configuration::getBoolean() wrong option + * @return void */ public function testGetBooleanWrong() { @@ -260,8 +286,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getBoolean('wrong'); } + /** * Test \SimpleSAML\Configuration::getString() + * @return void */ public function testGetString() { @@ -272,8 +300,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getString('str_opt', '--missing--'), 'Hello World!'); } + /** * Test \SimpleSAML\Configuration::getString() missing option + * @return void */ public function testGetStringMissing() { @@ -282,8 +312,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getString('missing_opt'); } + /** * Test \SimpleSAML\Configuration::getString() wrong option + * @return void */ public function testGetStringWrong() { @@ -294,8 +326,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getString('wrong'); } + /** * Test \SimpleSAML\Configuration::getInteger() + * @return void */ public function testGetInteger() { @@ -306,8 +340,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getInteger('int_opt', '--missing--'), 42); } + /** * Test \SimpleSAML\Configuration::getInteger() missing option + * @return void */ public function testGetIntegerMissing() { @@ -316,8 +352,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getInteger('missing_opt'); } + /** * Test \SimpleSAML\Configuration::getInteger() wrong option + * @return void */ public function testGetIntegerWrong() { @@ -328,8 +366,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getInteger('wrong'); } + /** * Test \SimpleSAML\Configuration::getIntegerRange() + * @return void */ public function testGetIntegerRange() { @@ -340,8 +380,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getIntegerRange('int_opt', 0, 100), 42); } + /** * Test \SimpleSAML\Configuration::getIntegerRange() below limit + * @return void */ public function testGetIntegerRangeBelow() { @@ -352,8 +394,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getIntegerRange('int_opt', 10, 100), 42); } + /** * Test \SimpleSAML\Configuration::getIntegerRange() above limit + * @return void */ public function testGetIntegerRangeAbove() { @@ -364,8 +408,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getIntegerRange('int_opt', 10, 100), 42); } + /** * Test \SimpleSAML\Configuration::getValueValidate() + * @return void */ public function testGetValueValidate() { @@ -376,8 +422,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getValueValidate('opt', ['a', 'b', 'c']), 'b'); } + /** * Test \SimpleSAML\Configuration::getValueValidate() wrong option + * @return void */ public function testGetValueValidateWrong() { @@ -388,8 +436,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getValueValidate('opt', ['a', 'b', 'c']); } + /** * Test \SimpleSAML\Configuration::getArray() + * @return void */ public function testGetArray() { @@ -400,8 +450,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getArray('opt'), ['a', 'b', 'c']); } + /** * Test \SimpleSAML\Configuration::getArray() wrong option + * @return void */ public function testGetArrayWrong() { @@ -412,8 +464,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getArray('opt'); } + /** * Test \SimpleSAML\Configuration::getArrayize() + * @return void */ public function testGetArrayize() { @@ -428,8 +482,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getArrayize('opt_str'), ['string']); } + /** * Test \SimpleSAML\Configuration::getArrayizeString() + * @return void */ public function testGetArrayizeString() { @@ -442,9 +498,11 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getArrayizeString('opt_str'), ['string']); } + /** * Test \SimpleSAML\Configuration::getArrayizeString() option * with an array that contains something that isn't a string. + * @return void */ public function testGetArrayizeStringWrongValue() { @@ -455,8 +513,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getArrayizeString('opt'); } + /** * Test \SimpleSAML\Configuration::getConfigItem() + * @return void */ public function testGetConfigItem() { @@ -469,8 +529,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($opt->getValue('a'), 42); } + /** * Test \SimpleSAML\Configuration::getConfigItem() wrong option + * @return void */ public function testGetConfigItemWrong() { @@ -481,8 +543,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getConfigItem('opt'); } + /** * Test \SimpleSAML\Configuration::getConfigList() + * @return void */ public function testGetConfigList() { @@ -502,8 +566,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($opts['b']->getValue('opt2'), 'value2'); } + /** * Test \SimpleSAML\Configuration::getConfigList() wrong option + * @return void */ public function testGetConfigListWrong() { @@ -517,6 +583,7 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase /** * Test \SimpleSAML\Configuration::getConfigList() with an array of wrong options. + * @return void */ public function testGetConfigListWrongArrayValues() { @@ -533,6 +600,7 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase /** * Test \SimpleSAML\Configuration::getOptions() + * @return void */ public function testGetOptions() { @@ -543,8 +611,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getOptions(), ['a', 'b']); } + /** * Test \SimpleSAML\Configuration::toArray() + * @return void */ public function testToArray() { @@ -560,6 +630,7 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase * Test \SimpleSAML\Configuration::getDefaultEndpoint(). * * Iterate over all different valid definitions of endpoints and check if the expected output is produced. + * @return void */ public function testGetDefaultEndpoint() { @@ -775,6 +846,7 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase /** * Test \SimpleSAML\Configuration::getEndpoints(). + * @return void */ public function testGetEndpoints() { @@ -879,6 +951,7 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase /** * Test \SimpleSAML\Configuration::getLocalizedString() + * @return void */ public function testGetLocalizedString() { @@ -894,8 +967,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals($c->getLocalizedString('str_array'), ['en' => 'Hello World!', 'no' => 'Hei Verden!']); } + /** * Test \SimpleSAML\Configuration::getLocalizedString() not array nor simple string + * @return void */ public function testGetLocalizedStringNotArray() { @@ -906,8 +981,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getLocalizedString('opt'); } + /** * Test \SimpleSAML\Configuration::getLocalizedString() not string key + * @return void */ public function testGetLocalizedStringNotStringKey() { @@ -918,8 +995,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getLocalizedString('opt'); } + /** * Test \SimpleSAML\Configuration::getLocalizedString() not string value + * @return void */ public function testGetLocalizedStringNotStringValue() { @@ -930,8 +1009,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $c->getLocalizedString('opt'); } + /** * Test \SimpleSAML\Configuration::getConfig() nonexistent file + * @return void */ public function testGetConfigNonexistentFile() { @@ -939,8 +1020,10 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase Configuration::getConfig('nonexistent-nopreload.php'); } + /** * Test \SimpleSAML\Configuration::getConfig() preloaded nonexistent file + * @return void */ public function testGetConfigNonexistentFilePreload() { @@ -953,10 +1036,12 @@ class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals('value', $nc->getValue('key', null)); } + /** * Test that Configuration objects can be initialized from an array. * * ATTENTION: this test must be kept the last. + * @return void */ public function testLoadInstanceFromArray() { diff --git a/tests/lib/SimpleSAML/DatabaseTest.php b/tests/lib/SimpleSAML/DatabaseTest.php index 444e9be260c7a6fd38c2780ab344842b873ba2dc..6ba5c9bf6a577c526dc6a2b23ca7cb90dccacb55 100644 --- a/tests/lib/SimpleSAML/DatabaseTest.php +++ b/tests/lib/SimpleSAML/DatabaseTest.php @@ -49,6 +49,7 @@ class DatabaseTest extends TestCase * @covers SimpleSAML\Database::generateInstanceId * @covers SimpleSAML\Database::__construct * @covers SimpleSAML\Database::connect + * @return void */ public function setUp() { @@ -80,6 +81,7 @@ class DatabaseTest extends TestCase * @covers SimpleSAML\Database::__construct * @covers SimpleSAML\Database::connect * @test + * @return void */ public function connectionFailure() { @@ -104,6 +106,7 @@ class DatabaseTest extends TestCase * @covers SimpleSAML\Database::__construct * @covers SimpleSAML\Database::connect * @test + * @return void */ public function instances() { @@ -173,6 +176,7 @@ class DatabaseTest extends TestCase * @covers SimpleSAML\Database::connect * @covers SimpleSAML\Database::getSlave * @test + * @return void */ public function slaves() { @@ -215,6 +219,7 @@ class DatabaseTest extends TestCase /** * @covers SimpleSAML\Database::applyPrefix * @test + * @return void */ public function prefix() { @@ -232,6 +237,7 @@ class DatabaseTest extends TestCase * @covers SimpleSAML\Database::exec * @covers SimpleSAML\Database::query * @test + * @return void */ public function querying() { @@ -264,6 +270,7 @@ class DatabaseTest extends TestCase * @covers SimpleSAML\Database::read * @covers SimpleSAML\Database::query * @test + * @return void */ public function readFailure() { @@ -279,6 +286,7 @@ class DatabaseTest extends TestCase * @covers SimpleSAML\Database::write * @covers SimpleSAML\Database::exec * @test + * @return void */ public function noSuchTable() { @@ -287,6 +295,9 @@ class DatabaseTest extends TestCase } + /** + * @return void + */ public function tearDown() { $table = $this->db->applyPrefix("sspdbt"); diff --git a/tests/lib/SimpleSAML/Locale/LanguageTest.php b/tests/lib/SimpleSAML/Locale/LanguageTest.php index 708d6b60c068dd2ada46ff0daed70ef750198482..66b137b9559ab9d9ce124f26b08ee724b28fabfd 100644 --- a/tests/lib/SimpleSAML/Locale/LanguageTest.php +++ b/tests/lib/SimpleSAML/Locale/LanguageTest.php @@ -10,6 +10,7 @@ class LanguageTest extends TestCase { /** * Test SimpleSAML\Locale\Language::getDefaultLanguage(). + * @return void */ public function testGetDefaultLanguage() { @@ -30,6 +31,7 @@ class LanguageTest extends TestCase /** * Test SimpleSAML\Locale\Language::getLanguageCookie(). + * @return void */ public function testGetLanguageCookie() { @@ -54,6 +56,7 @@ class LanguageTest extends TestCase /** * Test SimpleSAML\Locale\Language::getLanguageList(). + * @return void */ public function testGetLanguageListNoConfig() { @@ -67,6 +70,7 @@ class LanguageTest extends TestCase /** * Test SimpleSAML\Locale\Language::getLanguageList(). + * @return void */ public function testGetLanguageListCorrectConfig() { @@ -86,6 +90,7 @@ class LanguageTest extends TestCase /** * Test SimpleSAML\Locale\Language::getLanguageList(). + * @return void */ public function testGetLanguageListIncorrectConfig() { @@ -101,6 +106,7 @@ class LanguageTest extends TestCase /** * Test SimpleSAML\Locale\Language::getLanguageParameterName(). + * @return void */ public function testGetLanguageParameterName() { @@ -120,6 +126,7 @@ class LanguageTest extends TestCase /** * Test SimpleSAML\Locale\Language::isLanguageRTL(). + * @return void */ public function testIsLanguageRTL() { @@ -150,6 +157,7 @@ class LanguageTest extends TestCase /** * Test SimpleSAML\Locale\Language::setLanguage(). + * @return void */ public function testSetLanguage() { diff --git a/tests/lib/SimpleSAML/Locale/LocalizationTest.php b/tests/lib/SimpleSAML/Locale/LocalizationTest.php index ceeb823fba12480b83cf812efed375eee9fc3b48..bfc55457f5f7f2445bc629559f5188a261effeb8 100644 --- a/tests/lib/SimpleSAML/Locale/LocalizationTest.php +++ b/tests/lib/SimpleSAML/Locale/LocalizationTest.php @@ -8,6 +8,9 @@ use \SimpleSAML\Configuration; class LocalizationTest extends TestCase { + /** + * @return void + */ protected function setUp() { // Localization/Language code attempts to load a cookie, and looks in the config for a name of the cookie @@ -17,6 +20,7 @@ class LocalizationTest extends TestCase /** * Test SimpleSAML\Locale\Localization(). + * @return void */ public function testLocalization() { @@ -29,8 +33,10 @@ class LocalizationTest extends TestCase $this->assertEquals(Localization::DEFAULT_DOMAIN, 'messages'); } + /** * Test SimpleSAML\Locale\Localization::activateDomain(). + * @return void */ public function testAddDomain() { diff --git a/tests/lib/SimpleSAML/Locale/TranslateTest.php b/tests/lib/SimpleSAML/Locale/TranslateTest.php index b1266df4256afdb2f289603e3d82079090eadc6f..c8d47718e337a5bc81e6c7abc834f1ce89c15aab 100644 --- a/tests/lib/SimpleSAML/Locale/TranslateTest.php +++ b/tests/lib/SimpleSAML/Locale/TranslateTest.php @@ -7,9 +7,9 @@ use SimpleSAML\Locale\Translate; class TranslateTest extends TestCase { - /** * Test SimpleSAML\Locale\Translate::noop(). + * @return void */ public function testNoop() { @@ -20,8 +20,10 @@ class TranslateTest extends TestCase $this->assertEquals($testString, $t->noop($testString)); } + /** * Test SimpleSAML\Locale\Translate::t(). + * @return void */ public function testTFallback() { diff --git a/tests/lib/SimpleSAML/Metadata/MetaDataStorageHandlerTest.php b/tests/lib/SimpleSAML/Metadata/MetaDataStorageHandlerTest.php index d54c5c8e5f4bea95ac18016be535669bc81e4eaa..0221b972e7e77f4acfe5235a1de2ae92a1151e2f 100644 --- a/tests/lib/SimpleSAML/Metadata/MetaDataStorageHandlerTest.php +++ b/tests/lib/SimpleSAML/Metadata/MetaDataStorageHandlerTest.php @@ -8,9 +8,9 @@ use SimpleSAML\Test\Utils\ClearStateTestCase; class MetaDataStorageHandlerTest extends ClearStateTestCase { - /** * Test that loading specific entities works, and that metadata source precedence is followed + * @return void */ public function testLoadEntities() { diff --git a/tests/lib/SimpleSAML/Metadata/MetaDataStorageSourceTest.php b/tests/lib/SimpleSAML/Metadata/MetaDataStorageSourceTest.php index 372e6f9440c703d6b5c33886782b76df324a2963..45e57c5ff1aa554b57cc44db095b85a7a09122f7 100644 --- a/tests/lib/SimpleSAML/Metadata/MetaDataStorageSourceTest.php +++ b/tests/lib/SimpleSAML/Metadata/MetaDataStorageSourceTest.php @@ -12,6 +12,7 @@ class MetaDataStorageSourceTest extends \PHPUnit\Framework\TestCase { /** * Test \SimpleSAML\Metadata\MetaDataStorageSourceTest::getConfig XML bad source + * @return void */ public function testBadXMLSource() { @@ -19,8 +20,10 @@ class MetaDataStorageSourceTest extends \PHPUnit\Framework\TestCase \SimpleSAML\Metadata\MetaDataStorageSource::getSource(["type"=>"xml", "foo"=>"baa"]); } + /** * Test \SimpleSAML\Metadata\MetaDataStorageSourceTest::getConfig invalid static XML source + * @return void */ public function testInvalidStaticXMLSource() { @@ -32,8 +35,10 @@ class MetaDataStorageSourceTest extends \PHPUnit\Framework\TestCase \SimpleSAML\Metadata\MetaDataStorageSource::getSource(["type"=>"xml", "xml"=>$strTestXML]); } + /** * Test \SimpleSAML\Metadata\MetaDataStorageSourceTest::getConfig XML static XML source + * @return void */ public function testStaticXMLSource() { @@ -48,8 +53,10 @@ class MetaDataStorageSourceTest extends \PHPUnit\Framework\TestCase $this->assertCount(1, $idpSet, "Unexpectedly got metadata for an alternate entity than that defined"); } + /** * Test loading multiple entities + * @return void */ public function testLoadEntitiesStaticXMLSource() { @@ -82,6 +89,11 @@ class MetaDataStorageSourceTest extends \PHPUnit\Framework\TestCase $this->assertCount(0, $entities, 'no matches expected'); } + + /** + * @param string $entityId + * @return string + */ public static function generateIdpMetadataXml($entityId) { return " diff --git a/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php b/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php index 008a26063c5278b949007add51ac873bb0aa8b60..04d471791b254c4c025ea322fcbd79463d1c9a6c 100644 --- a/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php +++ b/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php @@ -13,6 +13,7 @@ class SAMLBuilderTest extends TestCase { /** * Test the requested attributes are valued correctly. + * @return void */ public function testAttributes() { @@ -139,8 +140,10 @@ class SAMLBuilderTest extends TestCase } } + /** * Test the working of the isDefault config option + * @return void */ public function testAttributeConsumingServiceDefault() { @@ -186,8 +189,10 @@ class SAMLBuilderTest extends TestCase $this->assertEquals("false", $acs1->getAttribute("isDefault")); } + /** * Test the index option is used correctly. + * @return void */ public function testAttributeConsumingServiceIndex() { @@ -225,8 +230,10 @@ class SAMLBuilderTest extends TestCase $this->assertEquals("15", $acs1->getAttribute("index")); } + /** * Test the required protocolSupportEnumeration in AttributeAuthorityDescriptor + * @return void */ public function testProtocolSupportEnumeration() { diff --git a/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php b/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php index 9490336ec34d0ca5ab1f8a350d3bbb3bdccd3a14..d7e6ef153ab62be3ab202bab76e3e6b229239613 100644 --- a/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php +++ b/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php @@ -16,6 +16,7 @@ class SAMLParserTest extends \SimpleSAML\Test\SigningTestCase { /** * Test Registration Info is parsed + * @return void */ public function testRegistrationInfo() { @@ -44,9 +45,11 @@ XML $this->assertEquals($expected, $metadata['RegistrationInfo']); } + /** * Test RegistrationInfo is inherited correctly from parent EntitiesDescriptor. * According to the spec overriding RegistrationInfo is not valid. We ignore attempts to override + * @return void */ public function testRegistrationInfoInheritance() { @@ -92,8 +95,10 @@ XML $this->assertEquals($expected, $metadata['RegistrationInfo']); } + /** * Test AttributeConsumingService is parsed + * @return void */ public function testAttributeConsumingServiceParsing() { @@ -140,6 +145,9 @@ XML } + /** + * @return \DOMDocument + */ public function makeTestDocument() { $doc = new \DOMDocument(); @@ -163,6 +171,10 @@ XML return $doc; } + + /** + * @return void + */ public function _testValidateFingerprint($algo, $expected_fingerprint) { $doc = $this->makeTestDocument(); @@ -175,6 +187,9 @@ XML } + /** + * @return void + */ public function testValidateFingerprintSHA1() { $this->_testValidateFingerprint( @@ -184,6 +199,9 @@ XML } + /** + * @return void + */ public function testValidateFingerprintSHA256() { $this->_testValidateFingerprint( @@ -194,6 +212,9 @@ XML } + /** + * @return void + */ public function testValidateFingerprintSHA384() { $this->_testValidateFingerprint( @@ -205,6 +226,9 @@ XML } + /** + * @return void + */ public function testValidateFingerprintSHA512() { $this->_testValidateFingerprint( @@ -216,6 +240,9 @@ XML } + /** + * @return void + */ public function testValidateFingerprintUnknownAlgorithmThrows() { $doc = $this->makeTestDocument(); @@ -236,8 +263,10 @@ XML } } + /** * Test RoleDescriptor/Extensions is parsed + * @return void */ public function testRoleDescriptorExtensions() { diff --git a/tests/lib/SimpleSAML/ModuleTest.php b/tests/lib/SimpleSAML/ModuleTest.php index 228ab0aed6b029041b0dc91b4c3cab9b07c5c8bd..fa57828498d2f92255482f062760476cdc4d5971 100644 --- a/tests/lib/SimpleSAML/ModuleTest.php +++ b/tests/lib/SimpleSAML/ModuleTest.php @@ -9,6 +9,7 @@ class ModuleTest extends TestCase { /** * Test for SimpleSAML\Module::isModuleEnabled(). + * @return void */ public function testIsModuleEnabled() { @@ -19,6 +20,7 @@ class ModuleTest extends TestCase /** * Test for SimpleSAML\Module::getModuleDir(). + * @return void */ public function testGetModuleDir() { @@ -32,6 +34,7 @@ class ModuleTest extends TestCase /** * Test for SimpleSAML\Module::getModuleURL(). + * @return void */ public function testGetModuleURL() { @@ -54,6 +57,7 @@ class ModuleTest extends TestCase /** * Test for SimpleSAML\Module::getModules(). + * @return void */ public function testGetModules() { @@ -65,6 +69,7 @@ class ModuleTest extends TestCase * Test for SimpleSAML\Module::resolveClass(). It will make sure that an exception is thrown if we are not asking * for a class inside a module (that is, there is no colon separating the name of the module and the name of the * class). + * @return void */ public function testResolveClassNoModule() { @@ -76,6 +81,7 @@ class ModuleTest extends TestCase /** * Test for SimpleSAML\Module::resolveClass(). It will make sure that an exception is thrown if the class we are * asking for cannot be found. + * @return void */ public function testResolveClassNotFound() { @@ -87,6 +93,7 @@ class ModuleTest extends TestCase /** * Test for SimpleSAML\Module::resolveClass(). It will make sure that an exception is thrown if the class we are * asking for can be resolved, but does not extend a given class. + * @return void */ public function testResolveClassNotSubclass() { @@ -97,6 +104,7 @@ class ModuleTest extends TestCase /** * Test for SimpleSAML\Module::resolveClass(). It covers all the valid use cases. + * @return void */ public function tesstResolveClass() { diff --git a/tests/lib/SimpleSAML/Store/RedisTest.php b/tests/lib/SimpleSAML/Store/RedisTest.php index b1e8cc0e0b4d6564b812a7c5aea57bbc5058463c..cc59a69b71f17d27444866f37b77994a3eadf11d 100644 --- a/tests/lib/SimpleSAML/Store/RedisTest.php +++ b/tests/lib/SimpleSAML/Store/RedisTest.php @@ -16,6 +16,9 @@ use \SimpleSAML\Store; */ class RedisTest extends TestCase { + /** + * @return void + */ protected function setUp() { $this->config = []; @@ -47,31 +50,49 @@ class RedisTest extends TestCase $this->redis = new Store\Redis($this->mocked_redis); } + + /** + * @return \Predis\Client + */ public function getMocked($key) { return array_key_exists($key, $this->config) ? $this->config[$key] : null; } + + /** + * @return void + */ public function setMocked($key, $value) { $this->config[$key] = $value; } + + /** + * @return void + */ public function setexMocked($key, $expire, $value) { // Testing expiring data is more trouble than it's worth for now $this->setMocked($key, $value); } + + /** + * @return void + */ public function delMocked($key) { unset($this->config[$key]); } + /** * @covers \SimpleSAML\Store::getInstance * @covers \SimpleSAML\Store\Redis::__construct * @test + * @return void */ public function testRedisInstance() { @@ -88,10 +109,12 @@ class RedisTest extends TestCase $this->clearInstance($store, '\SimpleSAML\Store'); } + /** * @covers \SimpleSAML\Store::getInstance * @covers \SimpleSAML\Store\Redis::__construct * @test + * @return void */ public function testRedisInstanceWithPassword() { @@ -109,10 +132,12 @@ class RedisTest extends TestCase $this->clearInstance($store, '\SimpleSAML\Store'); } + /** * @covers \SimpleSAML\Store\Redis::get * @covers \SimpleSAML\Store\Redis::set * @test + * @return void */ public function testInsertData() { @@ -125,10 +150,12 @@ class RedisTest extends TestCase $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Store\Redis::get * @covers \SimpleSAML\Store\Redis::set * @test + * @return void */ public function testInsertExpiringData() { @@ -141,9 +168,11 @@ class RedisTest extends TestCase $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Store\Redis::get * @test + * @return void */ public function testGetEmptyData() { @@ -152,10 +181,12 @@ class RedisTest extends TestCase $this->assertNull($res); } + /** * @covers \SimpleSAML\Store\Redis::get * @covers \SimpleSAML\Store\Redis::set * @test + * @return void */ public function testOverwriteData() { @@ -170,11 +201,13 @@ class RedisTest extends TestCase $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Store\Redis::get * @covers \SimpleSAML\Store\Redis::set * @covers \SimpleSAML\Store\Redis::delete * @test + * @return void */ public function testDeleteData() { @@ -185,6 +218,10 @@ class RedisTest extends TestCase $this->assertNull($res); } + + /** + * @return void + */ protected function clearInstance($service, $className) { $reflectedClass = new \ReflectionClass($className); diff --git a/tests/lib/SimpleSAML/Store/SQLTest.php b/tests/lib/SimpleSAML/Store/SQLTest.php index cda9dc2908bbdadd580ee2abaf2089380180b84d..f9545575cc74b081fa274f98ce270e9ea09cac97 100644 --- a/tests/lib/SimpleSAML/Store/SQLTest.php +++ b/tests/lib/SimpleSAML/Store/SQLTest.php @@ -17,6 +17,9 @@ use \SimpleSAML\Store; */ class SQLTest extends TestCase { + /** + * @return void + */ protected function setUp() { Configuration::loadFromArray([ @@ -26,10 +29,12 @@ class SQLTest extends TestCase ], '[ARRAY]', 'simplesaml'); } + /** * @covers \SimpleSAML\Store::getInstance * @covers \SimpleSAML\Store\SQL::__construct * @test + * @return void */ public function SQLInstance() { @@ -38,10 +43,12 @@ class SQLTest extends TestCase $this->assertInstanceOf('SimpleSAML\Store\SQL', $store); } + /** * @covers \SimpleSAML\Store\SQL::initTableVersionTable * @covers \SimpleSAML\Store\SQL::initKVTable * @test + * @return void */ public function kvstoreTableVersion() { @@ -53,9 +60,11 @@ class SQLTest extends TestCase $this->assertEquals(2, $version); } + /** * @covers \SimpleSAML\Store\SQL::getTableVersion * @test + * @return void */ public function newTableVersion() { @@ -67,10 +76,12 @@ class SQLTest extends TestCase $this->assertEquals(0, $version); } + /** * @covers \SimpleSAML\Store\SQL::setTableVersion * @covers \SimpleSAML\Store\SQL::insertOrUpdate * @test + * @return void */ public function testSetTableVersion() { @@ -83,9 +94,11 @@ class SQLTest extends TestCase $this->assertEquals(2, $version); } + /** * @covers \SimpleSAML\Store\SQL::get * @test + * @return void */ public function testGetEmptyData() { @@ -97,11 +110,13 @@ class SQLTest extends TestCase $this->assertNull($value); } + /** * @covers \SimpleSAML\Store\SQL::get * @covers \SimpleSAML\Store\SQL::set * @covers \SimpleSAML\Store\SQL::insertOrUpdate * @test + * @return void */ public function testInsertData() { @@ -114,11 +129,13 @@ class SQLTest extends TestCase $this->assertEquals('bar', $value); } + /** * @covers \SimpleSAML\Store\SQL::get * @covers \SimpleSAML\Store\SQL::set * @covers \SimpleSAML\Store\SQL::insertOrUpdate * @test + * @return void */ public function testOverwriteData() { @@ -132,12 +149,14 @@ class SQLTest extends TestCase $this->assertEquals('baz', $value); } + /** * @covers \SimpleSAML\Store\SQL::get * @covers \SimpleSAML\Store\SQL::set * @covers \SimpleSAML\Store\SQL::insertOrUpdate * @covers \SimpleSAML\Store\SQL::delete * @test + * @return void */ public function testDeleteData() { @@ -151,12 +170,14 @@ class SQLTest extends TestCase $this->assertNull($value); } + /** * @covers \SimpleSAML\Store\SQL::get * @covers \SimpleSAML\Store\SQL::set * @covers \SimpleSAML\Store\SQL::insertOrUpdate * @covers \SimpleSAML\Store\SQL::delete * @test + * @return void */ public function testVeryLongKey() { @@ -171,6 +192,10 @@ class SQLTest extends TestCase $this->assertNull($value); } + + /** + * @return void + */ protected function tearDown() { $config = Configuration::getInstance(); @@ -180,6 +205,10 @@ class SQLTest extends TestCase $this->clearInstance($store, '\SimpleSAML\Store'); } + + /** + * @return void + */ protected function clearInstance($service, $className) { $reflectedClass = new \ReflectionClass($className); diff --git a/tests/lib/SimpleSAML/StoreTest.php b/tests/lib/SimpleSAML/StoreTest.php index 4c54e574f43c1b0b0b05f0bb17f89ab1990c0046..0b12b96574baa20107949005714cb695eb412d57 100644 --- a/tests/lib/SimpleSAML/StoreTest.php +++ b/tests/lib/SimpleSAML/StoreTest.php @@ -22,6 +22,7 @@ class StoreTest extends TestCase /** * @covers \SimpleSAML\Store::getInstance * @test + * @return void */ public function defaultStore() { @@ -37,6 +38,7 @@ class StoreTest extends TestCase /** * @covers \SimpleSAML\Store::getInstance * @test + * @return void */ public function phpSessionStore() { @@ -52,6 +54,7 @@ class StoreTest extends TestCase /** * @covers \SimpleSAML\Store::getInstance * @test + * @return void */ public function memcacheStore() { @@ -68,6 +71,7 @@ class StoreTest extends TestCase /** * @covers \SimpleSAML\Store::getInstance * @test + * @return void */ public function sqlStore() { @@ -86,6 +90,7 @@ class StoreTest extends TestCase /** * @covers \SimpleSAML\Store::getInstance * @test + * @return void */ public function pathStore() { @@ -104,6 +109,7 @@ class StoreTest extends TestCase /** * @covers \SimpleSAML\Store::getInstance * @test + * @return void */ public function notFoundStoreException() { @@ -118,6 +124,9 @@ class StoreTest extends TestCase } + /** + * @return void + */ protected function tearDown() { $config = Configuration::getInstance(); @@ -128,6 +137,9 @@ class StoreTest extends TestCase } + /** + * @return void + */ protected function clearInstance($service, $className) { $reflectedClass = new \ReflectionClass($className); diff --git a/tests/lib/SimpleSAML/Utils/ArraysTest.php b/tests/lib/SimpleSAML/Utils/ArraysTest.php index eb3d1b66843ff302c0bb6657ea7786b2b36db698..9d103d32024c69ccbe79df271894f6d1102a5547 100644 --- a/tests/lib/SimpleSAML/Utils/ArraysTest.php +++ b/tests/lib/SimpleSAML/Utils/ArraysTest.php @@ -12,6 +12,7 @@ class ArraysTest extends TestCase { /** * Test the arrayize() function. + * @return void */ public function testArrayize() { @@ -39,6 +40,7 @@ class ArraysTest extends TestCase /** * Test the transpose() function. + * @return void */ public function testTranspose() { diff --git a/tests/lib/SimpleSAML/Utils/AttributesTest.php b/tests/lib/SimpleSAML/Utils/AttributesTest.php index fd66017a9b14ab80b8a67a277b0ebd61c9e56a57..0209654bc8e972aee9809dd1ab5bc451cc94ac3d 100644 --- a/tests/lib/SimpleSAML/Utils/AttributesTest.php +++ b/tests/lib/SimpleSAML/Utils/AttributesTest.php @@ -14,6 +14,7 @@ class AttributesTest extends TestCase { /** * Test the getExpectedAttribute() method with invalid attributes array. + * @return void */ public function testGetExpectedAttributeInvalidAttributesArray() { @@ -30,6 +31,7 @@ class AttributesTest extends TestCase /** * Test the getExpectedAttributeMethod() method with invalid expected attribute parameter. + * @return void */ public function testGetExpectedAttributeInvalidAttributeName() { @@ -46,6 +48,7 @@ class AttributesTest extends TestCase /** * Test the getExpectedAttributeMethod() method with a non-normalized attributes array. + * @return void */ public function testGetExpectedAttributeNonNormalizedArray() { @@ -64,6 +67,7 @@ class AttributesTest extends TestCase /** * Test the getExpectedAttribute() method with valid input but missing expected attribute. + * @return void */ public function testGetExpectedAttributeMissingAttribute() { @@ -82,6 +86,7 @@ class AttributesTest extends TestCase /** * Test the getExpectedAttribute() method with an empty attribute. + * @return void */ public function testGetExpectedAttributeEmptyAttribute() { @@ -100,6 +105,7 @@ class AttributesTest extends TestCase /** * Test the getExpectedAttributeMethod() method with multiple values (not being allowed). + * @return void */ public function testGetExpectedAttributeMultipleValues() { @@ -121,6 +127,7 @@ class AttributesTest extends TestCase /** * Test that the getExpectedAttribute() method successfully obtains values from the attributes array. + * @return void */ public function testGetExpectedAttribute() { @@ -144,6 +151,7 @@ class AttributesTest extends TestCase /** * Test the normalizeAttributesArray() function with input not being an array + * @return void */ public function testNormalizeAttributesArrayBadInput() { @@ -151,8 +159,10 @@ class AttributesTest extends TestCase Attributes::normalizeAttributesArray('string'); } + /** * Test the normalizeAttributesArray() function with an array with non-string attribute names. + * @return void */ public function testNormalizeAttributesArrayBadKeys() { @@ -160,8 +170,10 @@ class AttributesTest extends TestCase Attributes::normalizeAttributesArray(['attr1' => 'value1', 1 => 'value2']); } + /** * Test the normalizeAttributesArray() function with an array with non-string attribute values. + * @return void */ public function testNormalizeAttributesArrayBadValues() { @@ -169,8 +181,10 @@ class AttributesTest extends TestCase Attributes::normalizeAttributesArray(['attr1' => 'value1', 'attr2' => 0]); } + /** * Test the normalizeAttributesArray() function. + * @return void */ public function testNormalizeAttributesArray() { @@ -194,6 +208,7 @@ class AttributesTest extends TestCase /** * Test the getAttributeNamespace() function. + * @return void */ public function testNamespacedAttributes() { diff --git a/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php b/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php index 21f56b65e8365c1444d3fce167f7464619625804..74e9c217cc98e7c297b117adbf730db384bbb0e9 100644 --- a/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php +++ b/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php @@ -10,9 +10,9 @@ use SimpleSAML\Utils\Config\Metadata; */ class MetadataTest extends TestCase { - /** * Test contact configuration parsing and sanitizing. + * @return void */ public function testGetContact() { @@ -227,6 +227,7 @@ class MetadataTest extends TestCase /** * Test \SimpleSAML\Utils\Config\Metadata::isHiddenFromDiscovery(). + * @return void */ public function testIsHiddenFromDiscovery() { @@ -263,6 +264,7 @@ class MetadataTest extends TestCase /** * Test \SimpleSAML\Utils\Config\Metadata::parseNameIdPolicy(). + * @return void */ public function testParseNameIdPolicy() { diff --git a/tests/lib/SimpleSAML/Utils/ConfigTest.php b/tests/lib/SimpleSAML/Utils/ConfigTest.php index 10a3d4e6020f2af6068e479677a917b0bf148ad6..41052cf02ee815fb4dfb59050234b8a4919c355e 100644 --- a/tests/lib/SimpleSAML/Utils/ConfigTest.php +++ b/tests/lib/SimpleSAML/Utils/ConfigTest.php @@ -10,9 +10,9 @@ use SimpleSAML\Utils\Config; */ class ConfigTest extends TestCase { - /** * Test default config dir with not environment variable + * @return void */ public function testDefaultConfigDir() { @@ -26,6 +26,7 @@ class ConfigTest extends TestCase /** * Test valid dir specified by env var overrides default config dir + * @return void */ public function testEnvVariableConfigDir() { @@ -37,6 +38,7 @@ class ConfigTest extends TestCase /** * Test valid dir specified by env redirect var overrides default config dir + * @return void */ public function testEnvRedirectVariableConfigDir() { @@ -46,8 +48,10 @@ class ConfigTest extends TestCase $this->assertEquals($configDir, __DIR__); } + /** * Test which directory takes precedence + * @return void */ public function testEnvRedirectPriorityVariableConfigDir() { @@ -61,6 +65,7 @@ class ConfigTest extends TestCase /** * Test invalid dir specified by env var results in a thrown exception + * @return void */ public function testInvalidEnvVariableConfigDirThrowsException() { diff --git a/tests/lib/SimpleSAML/Utils/CryptoTest.php b/tests/lib/SimpleSAML/Utils/CryptoTest.php index ed4d2b47015c0ee4cc49862b08676d53013d83eb..45e7a3502fa80bd16d6fd4c5cf77e40decf193b5 100644 --- a/tests/lib/SimpleSAML/Utils/CryptoTest.php +++ b/tests/lib/SimpleSAML/Utils/CryptoTest.php @@ -14,8 +14,13 @@ use \org\bovigo\vfs\vfsStream; class CryptoTest extends TestCase { const ROOTDIRNAME = 'testdir'; + const DEFAULTCERTDIR = 'certdir'; + + /** + * @return void + */ public function setUp() { $this->root = vfsStream::setup( @@ -29,10 +34,12 @@ class CryptoTest extends TestCase $this->certdir = $this->root_directory.DIRECTORY_SEPARATOR.self::DEFAULTCERTDIR; } + /** * Test invalid input provided to the aesDecrypt() method. * * @covers \SimpleSAML\Utils\Crypto::aesDecrypt + * @return void */ public function testAesDecryptBadInput() { @@ -48,6 +55,7 @@ class CryptoTest extends TestCase * Test invalid input provided to the aesEncrypt() method. * * @covers \SimpleSAML\Utils\Crypto::aesEncrypt + * @return void */ public function testAesEncryptBadInput() { @@ -64,6 +72,7 @@ class CryptoTest extends TestCase * ciphertext. * * @covers \SimpleSAML\Utils\Crypto::aesDecrypt + * @return void */ public function testAesDecrypt() { @@ -86,6 +95,7 @@ class CryptoTest extends TestCase * * @covers \SimpleSAML\Utils\Crypto::aesDecrypt * @covers \SimpleSAML\Utils\Crypto::aesEncrypt + * @return void */ public function testAesEncrypt() { @@ -111,6 +121,7 @@ class CryptoTest extends TestCase * * @covers \SimpleSAML\Utils\Crypto::der2pem * @covers \SimpleSAML\Utils\Crypto::pem2der + * @return void */ public function testFormatConversion() { @@ -153,9 +164,11 @@ PHP; $this->assertEquals(trim($pem), trim(Crypto::der2pem(Crypto::pem2der($pem)))); } + /** * @covers \SimpleSAML\Utils\Crypto::pwHash * @deprecated To be removed for 2.0 + * @return void */ public function testGoodPwHash() { @@ -177,6 +190,7 @@ PHP; /** * @covers \SimpleSAML\Utils\Crypto::pwHash * @deprecated To be removed for 2.0 + * @return void */ public function testGoodSaltedPwHash() { @@ -195,10 +209,12 @@ PHP; $this->assertEquals($expected, $res); } + /** * @deprecated To be removed for 2.0 * * @covers \SimpleSAML\Utils\Crypto::pwHash + * @return void */ public function testBadHashAlgorithm() { @@ -209,8 +225,10 @@ PHP; Crypto::pwHash($pw, $algorithm); } + /** * @covers \SimpleSAML\Utils\Crypto::pwValid + * @return void */ public function testGoodPwValid() { @@ -222,8 +240,10 @@ PHP; $this->assertTrue($res); } + /** * @covers \SimpleSAML\Utils\Crypto::pwValid + * @return void */ public function testBadPwInvalid() { @@ -240,6 +260,7 @@ PHP; /** * @covers \SimpleSAML\Utils\Crypto::pwValid * @deprecated To be removed for 2.0 + * @return void */ public function testGoodPwValidOld() { @@ -252,9 +273,11 @@ PHP; $this->assertTrue($res); } + /** * @covers \SimpleSAML\Utils\Crypto::pwValid * @deprecated To be removed for 2.0 + * @return void */ public function testGoodSaltedPwValid() { @@ -268,10 +291,12 @@ PHP; $this->assertTrue($res); } + /** * @deprecated To be removed for 2.0 * * @covers \SimpleSAML\Utils\Crypto::pwValid + * @return void */ public function testBadHashAlgorithmValid() { @@ -282,8 +307,10 @@ PHP; Crypto::pwValid($hash, $algorithm); } + /** * @covers \SimpleSAML\Utils\Crypto::secureCompare + * @return void */ public function testSecureCompareEqual() { @@ -292,8 +319,10 @@ PHP; $this->assertTrue($res); } + /** * @covers \SimpleSAML\Utils\Crypto::secureCompare + * @return void */ public function testSecureCompareNotEqual() { @@ -302,8 +331,10 @@ PHP; $this->assertFalse($res); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPrivateKey + * @return void */ public function testLoadPrivateKeyRequiredMetadataMissing() { @@ -314,8 +345,10 @@ PHP; Crypto::loadPrivateKey($config, $required); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPrivateKey + * @return void */ public function testLoadPrivateKeyNotRequiredMetadataMissing() { @@ -327,8 +360,10 @@ PHP; $this->assertNull($res); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPrivateKey + * @return void */ public function testLoadPrivateKeyMissingFile() { @@ -338,8 +373,10 @@ PHP; Crypto::loadPrivateKey($config, false, '', true); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPrivateKey + * @return void */ public function testLoadPrivateKeyBasic() { @@ -356,8 +393,10 @@ PHP; $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPrivateKey + * @return void */ public function testLoadPrivateKeyPassword() { @@ -381,8 +420,10 @@ PHP; $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPrivateKey + * @return void */ public function testLoadPrivateKeyPrefix() { @@ -407,8 +448,10 @@ PHP; $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPublicKey + * @return void */ public function testLoadPublicKeyRequiredMetadataMissing() { @@ -419,8 +462,10 @@ PHP; Crypto::loadPublicKey($config, $required); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPublicKey + * @return void */ public function testLoadPublicKeyNotRequiredMetadataMissing() { @@ -432,8 +477,10 @@ PHP; $this->assertNull($res); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPublicKey + * @return void */ public function testLoadPublicKeyFingerprintBasicString() { @@ -446,8 +493,10 @@ PHP; $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPublicKey + * @return void */ public function testLoadPublicKeyFingerprintBasicArray() { @@ -469,8 +518,10 @@ PHP; $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPublicKey + * @return void */ public function testLoadPublicKeyFingerprintLowercase() { @@ -483,8 +534,10 @@ PHP; $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPublicKey + * @return void */ public function testLoadPublicKeyFingerprintRemoveColons() { @@ -497,8 +550,10 @@ PHP; $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPublicKey + * @return void */ public function testLoadPublicKeyNotX509Certificate() { @@ -520,8 +575,10 @@ PHP; $this->assertNull($res); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPublicKey + * @return void */ public function testLoadPublicKeyNotSigning() { @@ -543,8 +600,10 @@ PHP; $this->assertNull($res); } + /** * @covers \SimpleSAML\Utils\Crypto::loadPublicKey + * @return void */ public function testLoadPublicKeyBasic() { diff --git a/tests/lib/SimpleSAML/Utils/EMailTestCase.php b/tests/lib/SimpleSAML/Utils/EMailTestCase.php index 6c01432ca6ebcdd402962216858ca645d7d25713..be6fe955d0b3e78f93c78d1b073e1ae6a5a29dea 100644 --- a/tests/lib/SimpleSAML/Utils/EMailTestCase.php +++ b/tests/lib/SimpleSAML/Utils/EMailTestCase.php @@ -12,6 +12,9 @@ use SimpleSAML\Utils\EMail; */ class EMailTestCase extends ClearStateTestCase { + /** + * @return void + */ public function setUp() { parent::setUp(); @@ -22,9 +25,11 @@ class EMailTestCase extends ClearStateTestCase ], '[ARRAY]', 'simplesaml'); } + /** * Test that an exception is thrown if using default configuration, * and no custom from address is specified. + * @return void */ public function testMailFromDefaultConfigurationException() { @@ -32,8 +37,10 @@ class EMailTestCase extends ClearStateTestCase new EMail('test', null, 'phpunit@simplesamlphp.org'); } + /** * Test that an exception is thrown if using an invalid "From"-address + * @return void */ public function testInvalidFromAddressException() { @@ -41,8 +48,10 @@ class EMailTestCase extends ClearStateTestCase new EMail('test', "phpunit@simplesamlphp.org\nLorem Ipsum", 'phpunit@simplesamlphp.org'); } + /** * Test that an exception is thrown if using an invalid "To"-address + * @return void */ public function testInvalidToAddressException() { @@ -50,9 +59,11 @@ class EMailTestCase extends ClearStateTestCase new EMail('test', 'phpunit@simplesamlphp.org', "phpunit@simplesamlphp.org\nLorem Ipsum"); } + /** * Test that the data given is visible in the resulting mail * @dataProvider mailTemplates + * @return void */ public function testMailContents($template) { @@ -66,12 +77,20 @@ class EMailTestCase extends ClearStateTestCase $this->assertRegexp('/(value-){6}/', $result); } - /** All templates that should be tested in #testMailContents($template) */ + + /** + * All templates that should be tested in #testMailContents($template) + * @return array + */ public static function mailTemplates() { return [['mailtxt.twig'], ['mailhtml.twig']]; } + + /** + * @return void + */ public function testInvalidTransportConfiguration() { // preserve the original configuration @@ -90,6 +109,10 @@ class EMailTestCase extends ClearStateTestCase Configuration::loadFromArray($originalTestConfiguration, '[ARRAY]', 'simplesaml'); } + + /** + * @return void + */ public function testInvalidSMTPConfiguration() { // setup a new email diff --git a/tests/lib/SimpleSAML/Utils/HTTPTest.php b/tests/lib/SimpleSAML/Utils/HTTPTest.php index ad8516be64dcbb8f5ed5ee66c202c0534eef16e8..0940abc17d534ab35f11f37298482e5ab505621b 100644 --- a/tests/lib/SimpleSAML/Utils/HTTPTest.php +++ b/tests/lib/SimpleSAML/Utils/HTTPTest.php @@ -12,6 +12,7 @@ class HTTPTest extends TestCase * Set up the environment ($_SERVER) populating the typical variables from a given URL. * * @param string $url The URL to use as the current one. + * @return void */ private function setupEnvFromURL($url) { @@ -32,8 +33,10 @@ class HTTPTest extends TestCase $_SERVER['REQUEST_URI'] = $addr['path'].'?'.$addr['query']; } + /** * Test SimpleSAML\Utils\HTTP::addURLParameters(). + * @return void */ public function testAddURLParametersInvalidURL() { @@ -41,8 +44,10 @@ class HTTPTest extends TestCase HTTP::addURLParameters([], []); } + /** * Test SimpleSAML\Utils\HTTP::addURLParameters(). + * @return void */ public function testAddURLParametersInvalidParameters() { @@ -50,8 +55,10 @@ class HTTPTest extends TestCase HTTP::addURLParameters('string', 'string'); } + /** * Test SimpleSAML\Utils\HTTP::addURLParameters(). + * @return void */ public function testAddURLParameters() { @@ -76,8 +83,10 @@ class HTTPTest extends TestCase $this->assertEquals($url.'&bar=foo', HTTP::addURLParameters($url, $params)); } + /** * Test SimpleSAML\Utils\HTTP::guessBasePath(). + * @return void */ public function testGuessBasePath() { @@ -118,8 +127,10 @@ class HTTPTest extends TestCase $_SERVER = $original; } + /** * Test SimpleSAML\Utils\HTTP::getSelfHost() with and without custom port. + * @return void */ public function testGetSelfHost() { @@ -136,8 +147,10 @@ class HTTPTest extends TestCase $_SERVER = $original; } + /** * Test SimpleSAML\Utils\HTTP::getSelfHostWithPort(), with and without custom port. + * @return void */ public function testGetSelfHostWithPort() { @@ -163,8 +176,10 @@ class HTTPTest extends TestCase $_SERVER = $original; } + /** * Test SimpleSAML\Utils\HTTP::getSelfURL(). + * @return void */ public function testGetSelfURLMethods() { @@ -288,8 +303,10 @@ class HTTPTest extends TestCase $_SERVER = $original; } + /** * Test SimpleSAML\Utils\HTTP::checkURLAllowed(), without regex. + * @return void */ public function testCheckURLAllowedWithoutRegex() { @@ -318,8 +335,10 @@ class HTTPTest extends TestCase $_SERVER = $original; } + /** * Test SimpleSAML\Utils\HTTP::checkURLAllowed(), with regex. + * @return void */ public function testCheckURLAllowedWithRegex() { @@ -350,8 +369,10 @@ class HTTPTest extends TestCase $_SERVER = $original; } + /** * Test SimpleSAML\Utils\HTTP::getServerPort(). + * @return void */ public function testGetServerPort() { @@ -394,9 +415,11 @@ class HTTPTest extends TestCase $_SERVER = $original; } + /** * Test SimpleSAML\Utils\HTTP::checkURLAllowed(), with the regex as a * subdomain of an evil domain. + * @return void */ public function testCheckURLAllowedWithRegexWithoutDelimiters() { @@ -415,8 +438,10 @@ class HTTPTest extends TestCase $_SERVER = $original; } + /** * @covers SimpleSAML\Utils\HTTP::getFirstPathElement() + * @return void */ public function testGetFirstPathElement() { diff --git a/tests/lib/SimpleSAML/Utils/NetTest.php b/tests/lib/SimpleSAML/Utils/NetTest.php index 8b23bb44aaf709e7993195bffadc8aeb40d17fa3..df25c83ffdb0d5baf1e9c0a32ae12bd6fb68b4b5 100644 --- a/tests/lib/SimpleSAML/Utils/NetTest.php +++ b/tests/lib/SimpleSAML/Utils/NetTest.php @@ -14,6 +14,7 @@ class NetTest extends TestCase * Test the function that checks for IPs belonging to a CIDR. * * @covers SimpleSAML\Utils\Net::ipCIDRcheck + * @return void */ public function testIpCIDRcheck() { @@ -49,6 +50,7 @@ class NetTest extends TestCase * Test IPv6 support in SimpleSAML\Utils\Net::ipCIDRcheck. * * @covers SimpleSAML\Utils\Net::ipCIDRcheck + * @return void */ public function testIpv6CIDRcheck() { diff --git a/tests/lib/SimpleSAML/Utils/RandomTest.php b/tests/lib/SimpleSAML/Utils/RandomTest.php index 6067faf070830ba24ac26745cb08d278ba07b134..d55fc95a0f6f3ed6ebb9e57a5823fd4da323ac39 100644 --- a/tests/lib/SimpleSAML/Utils/RandomTest.php +++ b/tests/lib/SimpleSAML/Utils/RandomTest.php @@ -14,6 +14,7 @@ class RandomTest extends TestCase * Test for SimpleSAML\Utils\Random::generateID(). * * @covers SimpleSAML\Utils\Random::generateID + * @return void */ public function testGenerateID() { diff --git a/tests/lib/SimpleSAML/Utils/SystemTest.php b/tests/lib/SimpleSAML/Utils/SystemTest.php index 37270a1bd550c79e15a75064bfe9c7891119d898..e64ef4d8acb8b414da95ac0fd873849a0861afc8 100644 --- a/tests/lib/SimpleSAML/Utils/SystemTest.php +++ b/tests/lib/SimpleSAML/Utils/SystemTest.php @@ -3,8 +3,8 @@ namespace SimpleSAML\Test\Utils; use PHPUnit\Framework\TestCase; -use \SimpleSAML\Configuration; -use \SimpleSAML\Utils\System; +use SimpleSAML\Configuration; +use SimpleSAML\Utils\System; use \org\bovigo\vfs\vfsStream; @@ -14,8 +14,13 @@ use \org\bovigo\vfs\vfsStream; class SystemTest extends TestCase { const ROOTDIRNAME = 'testdir'; + const DEFAULTTEMPDIR = 'tempdir'; + + /** + * @return void + */ public function setUp() { $this->root = vfsStream::setup( @@ -28,9 +33,11 @@ class SystemTest extends TestCase $this->root_directory = vfsStream::url(self::ROOTDIRNAME); } + /** * @covers \SimpleSAML\Utils\System::getOS * @test + * @return void */ public function testGetOSBasic() { @@ -39,9 +46,11 @@ class SystemTest extends TestCase $this->assertInternalType("int", $res); } + /** * @covers \SimpleSAML\Utils\System::resolvePath * @test + * @return void */ public function testResolvePathRemoveTrailingSlashes() { @@ -54,9 +63,11 @@ class SystemTest extends TestCase $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\System::resolvePath * @test + * @return void */ public function testResolvePathPreferAbsolutePathToBase() { @@ -69,9 +80,11 @@ class SystemTest extends TestCase $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\System::resolvePath * @test + * @return void */ public function testResolvePathCurDirPath() { @@ -84,9 +97,11 @@ class SystemTest extends TestCase $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\System::resolvePath * @test + * @return void */ public function testResolvePathParentPath() { @@ -99,9 +114,11 @@ class SystemTest extends TestCase $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\System::resolvePath * @test + * @return void */ public function testResolvePathAllowsStreamWrappers() { @@ -114,9 +131,11 @@ class SystemTest extends TestCase $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\System::resolvePath * @test + * @return void */ public function testResolvePathAllowsAwsS3StreamWrappers() { @@ -129,9 +148,11 @@ class SystemTest extends TestCase $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\System::writeFile * @test + * @return void */ public function testWriteFileInvalidArguments() { @@ -139,9 +160,11 @@ class SystemTest extends TestCase System::writeFile(null, null, null); } + /** * @covers \SimpleSAML\Utils\System::writeFile * @test + * @return void */ public function testWriteFileBasic() { @@ -157,9 +180,11 @@ class SystemTest extends TestCase $this->clearInstance($config, '\SimpleSAML\Configuration'); } + /** * @covers \SimpleSAML\Utils\System::writeFile * @test + * @return void */ public function testWriteFileContents() { @@ -179,9 +204,11 @@ class SystemTest extends TestCase $this->clearInstance($config, '\SimpleSAML\Configuration'); } + /** * @covers \SimpleSAML\Utils\System::writeFile * @test + * @return void */ public function testWriteFileMode() { @@ -201,9 +228,11 @@ class SystemTest extends TestCase $this->clearInstance($config, '\SimpleSAML\Configuration'); } + /** * @covers \SimpleSAML\Utils\System::getTempDir * @test + * @return void */ public function testGetTempDirBasic() { @@ -219,9 +248,11 @@ class SystemTest extends TestCase $this->clearInstance($config, '\SimpleSAML\Configuration'); } + /** * @covers \SimpleSAML\Utils\System::getTempDir * @test + * @return void */ public function testGetTempDirNonExistant() { @@ -237,10 +268,12 @@ class SystemTest extends TestCase $this->clearInstance($config, '\SimpleSAML\Configuration'); } + /** * @requires OS Linux * @covers \SimpleSAML\Utils\System::getTempDir * @test + * @return void */ public function testGetTempDirBadOwner() { @@ -260,6 +293,11 @@ class SystemTest extends TestCase $this->clearInstance($config, '\SimpleSAML\Configuration'); } + + + /** + * @return \SimpleSAML\Configuration + */ private function setConfigurationTempDir($directory) { $config = Configuration::loadFromArray([ @@ -269,6 +307,10 @@ class SystemTest extends TestCase return $config; } + + /** + * @return void + */ protected function clearInstance($service, $className) { $reflectedClass = new \ReflectionClass($className); diff --git a/tests/lib/SimpleSAML/Utils/TimeTest.php b/tests/lib/SimpleSAML/Utils/TimeTest.php index 6973a2180871c933fc92aecdff9ee8ea746f5002..157ff080b3d727e632a6919d68857dea66b2fcf9 100644 --- a/tests/lib/SimpleSAML/Utils/TimeTest.php +++ b/tests/lib/SimpleSAML/Utils/TimeTest.php @@ -11,6 +11,7 @@ class TimeTest extends TestCase * Test the SimpleSAML\Utils\Time::generateTimestamp() method. * * @covers SimpleSAML\Utils\Time::generateTimestamp + * @return void */ public function testGenerateTimestamp() { @@ -26,6 +27,7 @@ class TimeTest extends TestCase * Test the SimpleSAML\Utils\Time::initTimezone() method. * * @covers SimpleSAML\Utils\Time::initTimezone + * @return void */ public function testInitTimezone() { @@ -70,6 +72,7 @@ class TimeTest extends TestCase * Test the SimpleSAML\Utils\Time::parseDuration() method. * * @covers SimpleSAML\Utils\Time::parseDuration + * @return void */ public function testParseDuration() { diff --git a/tests/lib/SimpleSAML/Utils/XMLTest.php b/tests/lib/SimpleSAML/Utils/XMLTest.php index a65d527e9565bf67da91273cb1086d078ba1a221..938f4ef38587fc8fe4751e8876ec5457621d2211 100644 --- a/tests/lib/SimpleSAML/Utils/XMLTest.php +++ b/tests/lib/SimpleSAML/Utils/XMLTest.php @@ -15,6 +15,7 @@ class XMLTest extends TestCase /** * @covers \SimpleSAML\Utils\XML::isDOMNodeOfType * @test + * @return void */ public function testIsDomNodeOfTypeBasic() { @@ -27,9 +28,11 @@ class XMLTest extends TestCase $this->assertTrue($res); } + /** * @covers \SimpleSAML\Utils\XML::isDOMNodeOfType * @test + * @return void */ public function testIsDomNodeOfTypeMissingNamespace() { @@ -41,9 +44,11 @@ class XMLTest extends TestCase XML::isDOMNodeOfType($element, $name, $namespace_uri); } + /** * @covers \SimpleSAML\Utils\XML::isDOMNodeOfType * @test + * @return void */ public function testIsDomNodeOfTypeEmpty() { @@ -56,9 +61,11 @@ class XMLTest extends TestCase $this->assertFalse($res); } + /** * @covers \SimpleSAML\Utils\XML::isDOMNodeOfType * @test + * @return void */ public function testIsDomNodeOfTypeShortcut() { @@ -72,9 +79,11 @@ class XMLTest extends TestCase $this->assertTrue($res); } + /** * @covers \SimpleSAML\Utils\XML::isDOMNodeOfType * @test + * @return void */ public function testIsDomNodeOfTypeIncorrectName() { @@ -88,9 +97,11 @@ class XMLTest extends TestCase $this->assertFalse($res); } + /** * @covers \SimpleSAML\Utils\XML::isDOMNodeOfType * @test + * @return void */ public function testIsDomNodeOfTypeIncorrectNamespace() { @@ -104,9 +115,11 @@ class XMLTest extends TestCase $this->assertFalse($res); } + /** * @covers \SimpleSAML\Utils\XML::getDOMText * @test + * @return void */ public function testGetDomTextBasic() { @@ -121,9 +134,11 @@ class XMLTest extends TestCase $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\XML::getDOMText * @test + * @return void */ public function testGetDomTextMulti() { @@ -140,9 +155,11 @@ class XMLTest extends TestCase $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\XML::getDOMText * @test + * @return void */ public function testGetDomTextIncorrectType() { @@ -154,9 +171,11 @@ class XMLTest extends TestCase XML::getDOMText($element); } + /** * @covers \SimpleSAML\Utils\XML::getDOMChildren * @test + * @return void */ public function testGetDomChildrenBasic() { @@ -172,9 +191,11 @@ class XMLTest extends TestCase $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\XML::getDOMChildren * @test + * @return void */ public function testGetDomChildrenIncorrectType() { @@ -189,9 +210,11 @@ class XMLTest extends TestCase $this->assertEmpty($res); } + /** * @covers \SimpleSAML\Utils\XML::getDOMChildren * @test + * @return void */ public function testGetDomChildrenIncorrectName() { @@ -207,9 +230,11 @@ class XMLTest extends TestCase $this->assertEmpty($res); } + /** * @covers \SimpleSAML\Utils\XML::formatDOMElement * @test + * @return void */ public function testFormatDomElementBasic() { @@ -229,9 +254,11 @@ NOWDOC; $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\XML::formatDOMElement * @test + * @return void */ public function testFormatDomElementNested() { @@ -255,9 +282,11 @@ NOWDOC; $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\XML::formatDOMElement * @test + * @return void */ public function testFormatDomElementIndentBase() { @@ -282,9 +311,11 @@ HEREDOC; $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\XML::formatDOMElement * @test + * @return void */ public function testFormatDomElementTextAndChild() { @@ -305,9 +336,11 @@ HEREDOC; $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\XML::formatXMLString * @test + * @return void */ public function testFormatXmlStringBasic() { @@ -323,9 +356,11 @@ NOWDOC; $this->assertEquals($expected, $res); } + /** * @covers \SimpleSAML\Utils\XML::formatXMLString * @test + * @return void */ public function testFormatXmlStringMalformedXml() { @@ -335,9 +370,11 @@ NOWDOC; XML::formatXMLString($xml); } + /** * @covers \SimpleSAML\Utils\XML::isValid * @test + * @return void */ public function testIsValidMalformedXml() { @@ -349,9 +386,11 @@ NOWDOC; $this->assertContains($expected, $res); } + /** * @covers \SimpleSAML\Utils\XML::isValid * @test + * @return void */ public function testIsValidMetadata() { @@ -378,8 +417,10 @@ NOWDOC; $this->assertTrue($res); } + /** * @covers \SimpleSAML\Utils\XML::checkSAMLMessage() + * @return void */ public function testCheckSAMLMessageInvalidType() { diff --git a/tests/lib/SimpleSAML/XML/ErrorsTest.php b/tests/lib/SimpleSAML/XML/ErrorsTest.php index 4c0f929139c4b7ee1d467eb1d43e171f3f74723f..c671a23e1190c23dff05db877d3fd284eec1d733 100644 --- a/tests/lib/SimpleSAML/XML/ErrorsTest.php +++ b/tests/lib/SimpleSAML/XML/ErrorsTest.php @@ -21,6 +21,7 @@ class ErrorsTest extends TestCase * @covers \SimpleSAML\XML\Errors::addErrors * @covers \SimpleSAML\XML\Errors::end * @test + * @return void */ public function loggingErrors() { @@ -36,10 +37,12 @@ class ErrorsTest extends TestCase ); } + /** * @covers \SimpleSAML\XML\Errors::formatError * @covers \SimpleSAML\XML\Errors::formatErrors * @test + * @return void */ public function formatErrors() { diff --git a/tests/lib/SimpleSAML/XML/ParserTest.php b/tests/lib/SimpleSAML/XML/ParserTest.php index b0b84bd1ced253883d9239e454cf437262bb6259..35bc70c41bdfee889c9c8fafc0b5a0988bf5ffc0 100644 --- a/tests/lib/SimpleSAML/XML/ParserTest.php +++ b/tests/lib/SimpleSAML/XML/ParserTest.php @@ -25,15 +25,21 @@ XML; /** @var Parser */ private $xml; + + /** + * @return void + */ protected function setUp() { $this->xml = new Parser(static::XMLDOC); } + /** * @covers \SimpleSAML\XML\Parser::getValue * @covers \SimpleSAML\XML\Parser::__construct * @test + * @return void */ public function getValue() { @@ -44,10 +50,12 @@ XML; ); } + /** * @covers \SimpleSAML\XML\Parser::getValue * @covers \SimpleSAML\XML\Parser::__construct * @test + * @return void */ public function getEmptyValue() { @@ -59,11 +67,11 @@ XML; } - /** * @covers \SimpleSAML\XML\Parser::getValue * @covers \SimpleSAML\XML\Parser::__construct * @test + * @return void */ public function getValueException() { @@ -71,10 +79,12 @@ XML; $this->xml->getValue('/Root/Foo', true); } + /** * @covers \SimpleSAML\XML\Parser::getValueDefault * @covers \SimpleSAML\XML\Parser::__construct * @test + * @return void */ public function getDefaultValue() { @@ -90,6 +100,7 @@ XML; * @covers \SimpleSAML\XML\Parser::getValueAlternatives * @covers \SimpleSAML\XML\Parser::__construct * @test + * @return void */ public function getValueAlternatives() { @@ -107,10 +118,12 @@ XML; ); } + /** * @covers \SimpleSAML\XML\Parser::getValueAlternatives * @covers \SimpleSAML\XML\Parser::__construct * @test + * @return void */ public function getEmptyValueAlternatives() { @@ -128,10 +141,12 @@ XML; ); } + /** * @covers \SimpleSAML\XML\Parser::getValueAlternatives * @covers \SimpleSAML\XML\Parser::__construct * @test + * @return void */ public function getValueAlternativesException() { diff --git a/tests/lib/SimpleSAML/XML/Shib13/AuthnResponseTest.php b/tests/lib/SimpleSAML/XML/Shib13/AuthnResponseTest.php index c8a654917e672c4c4075f68963463e8d5b4f0eaf..1bc2c4af9fe909c22c90e70388829bdefcff2b10 100644 --- a/tests/lib/SimpleSAML/XML/Shib13/AuthnResponseTest.php +++ b/tests/lib/SimpleSAML/XML/Shib13/AuthnResponseTest.php @@ -51,20 +51,24 @@ XML; </Response> XML; - /** - * @var AuthnResponse - */ + /** @var AuthnResponse */ private $xml; + + /** + * @return void + */ protected function setUp() { $this->xml = new AuthnResponse(); $this->xml->setXML(static::XMLDOC); } + /** * @covers \SimpleSAML\XML\Shib13\AuthnResponse::setXML * @test + * @return void */ public function setXML() { @@ -72,11 +76,13 @@ XML; $this->xml->setXML(static::XMLDOC); } + /** * @covers \SimpleSAML\XML\Shib13\AuthnResponse::doXPathQuery * @covers \SimpleSAML\XML\Shib13\AuthnResponse::getIssuer * @covers \SimpleSAML\XML\Shib13\AuthnResponse::setXML * @test + * @return void */ public function getIssuer() { @@ -88,10 +94,12 @@ XML; ); } + /** * @covers \SimpleSAML\XML\Shib13\AuthnResponse::getIssuer * @covers \SimpleSAML\XML\Shib13\AuthnResponse::setXML * @test + * @return void */ public function getIssuerException() { @@ -102,10 +110,12 @@ XML; $xml->getIssuer(); } + /** * @covers \SimpleSAML\XML\Shib13\AuthnResponse::getNameID * @covers \SimpleSAML\XML\Shib13\AuthnResponse::setXML * @test + * @return void */ public function getNameID() { diff --git a/tests/lib/SimpleSAML/XML/SignerTest.php b/tests/lib/SimpleSAML/XML/SignerTest.php index 57a7aa4e23e1515fe8a32600d13c5989f2c033ba..70c4f1faa8a50f4f54df6ad386a29b54e8536b65 100644 --- a/tests/lib/SimpleSAML/XML/SignerTest.php +++ b/tests/lib/SimpleSAML/XML/SignerTest.php @@ -42,9 +42,15 @@ d2udRIYG0WcjQTk86+EraXNGtuwUaknQ7WPKlJwLzypuZM8lk3F1FXxXWomHN3SH NOWDOC; const ROOTDIRNAME = 'testdir'; + const DEFAULTCERTDIR = 'certdir'; + const OTHER_CERTIFICATE = 'other_certificate.pem'; + + /** + * @return array + */ public function getCertDirContent() { return [ @@ -54,6 +60,10 @@ NOWDOC; ]; } + + /** + * @return void + */ public function testSignerBasic() { $res = new Signer([]); @@ -61,6 +71,10 @@ NOWDOC; $this->assertNotNull($res); } + + /** + * @return void + */ public function testSignBasic() { $node = new \DOMDocument(); @@ -80,6 +94,10 @@ NOWDOC; $this->assertContains('SignatureValue', $res); } + + /** + * @return string + */ private static function getCertificateValue($certificate) { $replacements = [ @@ -91,6 +109,10 @@ NOWDOC; return str_replace($replacements, "", $certificate); } + + /** + * @return void + */ public function testSignWithCertificate() { $node = new \DOMDocument(); @@ -113,6 +135,10 @@ NOWDOC; $this->assertContains($expected, $res); } + + /** + * @return void + */ public function testSignWithMultiCertificate() { $this->other_certificate_file = $this->certdir.DIRECTORY_SEPARATOR.self::OTHER_CERTIFICATE; @@ -140,6 +166,10 @@ NOWDOC; $this->assertContains($expected2, $res); } + + /** + * @return void + */ public function testSignMissingPrivateKey() { $node = new \DOMDocument(); @@ -155,6 +185,10 @@ NOWDOC; $signer->sign($element, $insertInto); } + + /** + * @return void + */ protected function clearInstance($service, $className, $value = null) { $reflectedClass = new \ReflectionClass($className); diff --git a/tests/lib/SimpleSAML/XML/ValidatorTest.php b/tests/lib/SimpleSAML/XML/ValidatorTest.php index 772f2619e32c82d5388faaf6c1dfa5d01776dcc9..848c768eca3c3c5e8682a5d33e188498a6b695df 100644 --- a/tests/lib/SimpleSAML/XML/ValidatorTest.php +++ b/tests/lib/SimpleSAML/XML/ValidatorTest.php @@ -16,6 +16,9 @@ use \org\bovigo\vfs\vfsStream; */ class ValidatorTest extends SigningTestCase { + /** + * @return void + */ public function testValidatorMissingSignature() { $doc = new \DOMDocument(); @@ -25,6 +28,10 @@ class ValidatorTest extends SigningTestCase new Validator($doc); } + + /** + * @return void + */ public function testGetX509Certificate() { $doc = new \DOMDocument(); @@ -49,6 +56,10 @@ class ValidatorTest extends SigningTestCase $this->assertEquals($result, $expected); } + + /** + * @return void + */ public function testCertFingerprintSuccess() { $doc = new \DOMDocument(); @@ -76,6 +87,10 @@ class ValidatorTest extends SigningTestCase $this->assertInstanceOf(Validator::class, $validator); } + + /** + * @return void + */ public function testCertFingerprintFailure() { $doc = new \DOMDocument(); @@ -94,6 +109,10 @@ class ValidatorTest extends SigningTestCase new Validator($doc, 'node', ['certFingerprint' => []]); } + + /** + * @return void + */ public function testValidateFingerprintSuccess() { $doc = new \DOMDocument(); @@ -118,6 +137,10 @@ class ValidatorTest extends SigningTestCase $this->assertInstanceOf(Validator::class, $validator); } + + /** + * @return void + */ public function testValidateFingerprintFailure() { $doc = new \DOMDocument(); @@ -140,6 +163,10 @@ class ValidatorTest extends SigningTestCase $validator->validateFingerprint($fingerprint); } + + /** + * @return void + */ public function testIsNodeValidatedSuccess() { $doc = new \DOMDocument(); @@ -164,6 +191,10 @@ class ValidatorTest extends SigningTestCase $this->assertTrue($result); } + + /** + * @return void + */ public function testIsNodeValidatedFailure() { $doc = new \DOMDocument(); @@ -189,6 +220,10 @@ class ValidatorTest extends SigningTestCase $this->assertFalse($result); } + + /** + * @return void + */ public function testValidateCertificateMissingCAFile() { $ca_file = $this->ca_certificate_file.'NOT'; diff --git a/tests/modules/core/lib/Auth/Process/AttributeAddTest.php b/tests/modules/core/lib/Auth/Process/AttributeAddTest.php index b8701a8777cbe0e7e3a023d0f041b2e058252aae..dac7e8713e279f3a049050f7621a962638ca0e07 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeAddTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeAddTest.php @@ -9,7 +9,6 @@ use PHPUnit\Framework\TestCase; */ class AttributeAddTest extends TestCase { - /** * Helper function to run the filter with a given configuration. * @@ -24,8 +23,10 @@ class AttributeAddTest extends TestCase return $request; } + /** * Test the most basic functionality. + * @return void */ public function testBasic() { @@ -41,8 +42,10 @@ class AttributeAddTest extends TestCase $this->assertEquals($attributes['test'], ['value1', 'value2']); } + /** * Test that existing attributes are left unmodified. + * @return void */ public function testExistingNotModified() { @@ -65,8 +68,10 @@ class AttributeAddTest extends TestCase $this->assertEquals($attributes['original2'], ['original_value2']); } + /** * Test single string as attribute value. + * @return void */ public function testStringValue() { @@ -82,8 +87,10 @@ class AttributeAddTest extends TestCase $this->assertEquals($attributes['test'], ['value']); } + /** * Test adding multiple attributes in one config. + * @return void */ public function testAddMultiple() { @@ -102,8 +109,10 @@ class AttributeAddTest extends TestCase $this->assertEquals($attributes['test2'], ['value2']); } + /** * Test behavior when appending attribute values. + * @return void */ public function testAppend() { @@ -120,8 +129,10 @@ class AttributeAddTest extends TestCase $this->assertEquals($attributes['test'], ['value1', 'value2']); } + /** * Test replacing attribute values. + * @return void */ public function testReplace() { @@ -139,8 +150,10 @@ class AttributeAddTest extends TestCase $this->assertEquals($attributes['test'], ['value2']); } + /** * Test wrong usage generates exceptions + * @return void */ public function testWrongFlag() { @@ -157,8 +170,10 @@ class AttributeAddTest extends TestCase self::processFilter($config, $request); } + /** * Test wrong attribute value + * @return void */ public function testWrongAttributeValue() { diff --git a/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php b/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php index 5c113ccb3acba442d7c6c98d6233030e45765ce5..69f6a5aa1b078b4bd832de63617f76c3f6f849c8 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php @@ -9,7 +9,6 @@ use PHPUnit\Framework\TestCase; */ class AttributeAlterTest extends TestCase { - /** * Helper function to run the filter with a given configuration. * @@ -24,8 +23,10 @@ class AttributeAlterTest extends TestCase return $request; } + /** * Test the most basic functionality. + * @return void */ public function testBasic() { @@ -47,8 +48,10 @@ class AttributeAlterTest extends TestCase $this->assertEquals($attributes['test'], ['somethingisright']); } + /** * Test the most basic functionality. + * @return void */ public function testWithTarget() { @@ -73,8 +76,10 @@ class AttributeAlterTest extends TestCase $this->assertEquals($attributes['test2'], ['right']); } + /** * Module is a no op if subject attribute is not present. + * @return void */ public function testNomatch() { @@ -100,8 +105,10 @@ class AttributeAlterTest extends TestCase ); } + /** * Test replacing attribute value. + * @return void */ public function testReplaceMatch() { @@ -121,8 +128,10 @@ class AttributeAlterTest extends TestCase $this->assertEquals($attributes['source'], ['right']); } + /** * Test replacing attribute value. + * @return void */ public function testReplaceMatchWithTarget() { @@ -144,8 +153,10 @@ class AttributeAlterTest extends TestCase $this->assertEquals($attributes['test'], ['right']); } + /** * Test replacing attribute values. + * @return void */ public function testReplaceNoMatch() { @@ -167,10 +178,12 @@ class AttributeAlterTest extends TestCase $this->assertEquals($attributes['test'], ['right']); } + /** * Test removing attribute values. * Note that removing a value does not renumber the attributes array. * Also ensure unrelated attributes are not touched. + * @return void */ public function testRemoveMatch() { @@ -191,8 +204,10 @@ class AttributeAlterTest extends TestCase $this->assertEquals($attributes['eduPersonAffiliation'], [0 => 'member', 2 => 'staff']); } + /** * Test removing attribute values, resulting in an empty attribute. + * @return void */ public function testRemoveMatchAll() { @@ -212,8 +227,10 @@ class AttributeAlterTest extends TestCase $this->assertArrayNotHasKey('eduPersonAffiliation', $attributes); } + /** * Test for exception with illegal config. + * @return void */ public function testWrongConfig() { @@ -231,8 +248,10 @@ class AttributeAlterTest extends TestCase self::processFilter($config, $request); } + /** * Test for exception with illegal config. + * @return void */ public function testIncompleteConfig() { @@ -248,8 +267,10 @@ class AttributeAlterTest extends TestCase self::processFilter($config, $request); } + /** * Test for exception with illegal config. + * @return void */ public function testIncompleteConfig2() { @@ -267,8 +288,10 @@ class AttributeAlterTest extends TestCase self::processFilter($config, $request); } + /** * Test for exception with illegal config. + * @return void */ public function testIncompleteConfig3() { @@ -288,8 +311,10 @@ class AttributeAlterTest extends TestCase self::processFilter($config, $request); } + /** * Test for exception with illegal config. + * @return void */ public function testIncompleteConfig4() { @@ -312,6 +337,7 @@ class AttributeAlterTest extends TestCase /** * Test for exception with illegal config. + * @return void */ public function testIncompleteConfig5() { diff --git a/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php b/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php index 1193fa2de545ed3dfcba6e76ec3342aeeadbe269..a1a70d08803fcb51d6b134e7b75a1078c0a5f42b 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php @@ -24,8 +24,10 @@ class AttributeCopyTest extends TestCase return $request; } + /** * Test the most basic functionality. + * @return void */ public function testBasic() { @@ -42,8 +44,10 @@ class AttributeCopyTest extends TestCase $this->assertEquals($attributes['testnew'], ['AAP']); } + /** * Test the most basic functionality. + * @return void */ public function testArray() { @@ -62,8 +66,10 @@ class AttributeCopyTest extends TestCase $this->assertEquals($attributes['new2'], ['AAP']); } + /** * Test that existing attributes are left unmodified. + * @return void */ public function testExistingNotModified() { @@ -87,8 +93,10 @@ class AttributeCopyTest extends TestCase $this->assertEquals($attributes['original2'], ['original_value2']); } + /** * Test copying multiple attributes + * @return void */ public function testCopyMultiple() { @@ -107,8 +115,10 @@ class AttributeCopyTest extends TestCase $this->assertEquals($attributes['new2'], ['val2.1', 'val2.2']); } + /** * Test behaviour when target attribute exists (should be replaced). + * @return void */ public function testCopyClash() { @@ -126,8 +136,10 @@ class AttributeCopyTest extends TestCase $this->assertEquals($attributes['new1'], ['testvalue1']); } + /** * Test wrong attribute name + * @return void */ public function testWrongAttributeName() { @@ -143,8 +155,10 @@ class AttributeCopyTest extends TestCase self::processFilter($config, $request); } + /** * Test wrong attribute value + * @return void */ public function testWrongAttributeValue() { diff --git a/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php b/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php index 16eac75063d5641ea682c6ff060cad48c3c131f5..4d2fed99803f8aa4bdf717d72efe9fe2079a5371 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php @@ -9,6 +9,13 @@ use PHPUnit\Framework\TestCase; */ class AttributeLimitTest extends TestCase { + /** + * setUpBeforeClass a request that will be used for the following tests. + * note the above tests don't use self::$request for processFilter input. + */ + protected static $request; + + /** * Helper function to run the filter with a given configuration. * @@ -23,8 +30,10 @@ class AttributeLimitTest extends TestCase return $request; } + /** * Test reading IdP Attributes. + * @return void */ public function testIdPAttrs() { @@ -68,8 +77,10 @@ class AttributeLimitTest extends TestCase $this->assertCount(2, $attributes); } + /** * Tests when no attributes are in metadata. + * @return void */ public function testNULLMetadataAttrs() { @@ -123,12 +134,10 @@ class AttributeLimitTest extends TestCase $this->assertArrayHasKey('mail', $attributes); } + /** - * setUpBeforeClass a request that will be used for the following tests. - * note the above tests don't use self::$request for processFilter input. + * @return void */ - protected static $request; - public static function setUpBeforeClass() { self::$request = [ @@ -146,8 +155,10 @@ class AttributeLimitTest extends TestCase ]; } + /** * Test the most basic functionality. + * @return void */ public function testBasic() { @@ -162,8 +173,10 @@ class AttributeLimitTest extends TestCase $this->assertCount(2, $attributes); } + /** * Test defaults with metadata available. + * @return void */ public function testDefaultWithMetadata() { @@ -178,8 +191,10 @@ class AttributeLimitTest extends TestCase $this->assertCount(2, $attributes); } + /** * Test defaults with attributes and metadata + * @return void */ public function testDefaultWithAttrs() { @@ -197,8 +212,10 @@ class AttributeLimitTest extends TestCase $this->assertArrayNotHasKey('eduPersonAffiliation', $attributes); } + /** * Test for exception with illegal config. + * @return void */ public function testInvalidConfig() { @@ -210,8 +227,10 @@ class AttributeLimitTest extends TestCase self::processFilter($config, self::$request); } + /** * Test for invalid attribute name + * @return void */ public function testInvalidAttributeName() { @@ -226,6 +245,7 @@ class AttributeLimitTest extends TestCase /** * Test for attribute value matching + * @return void */ public function testMatchAttributeValues() { @@ -264,6 +284,10 @@ class AttributeLimitTest extends TestCase $this->assertCount(0, $attributes); } + + /** + * @return void + */ public function testBadOptionsNotTreatedAsValidValues() { // Ensure really misconfigured ignoreCase and regex options are not interpretted as valid valus @@ -276,9 +300,11 @@ class AttributeLimitTest extends TestCase $this->assertCount(0, $attributes); } + /** * Verify that the true value for ignoreCase doesn't get converted into a string ('1') by * php and matched against an attribute value of '1' + * @return void */ public function testThatIgnoreCaseOptionNotMatchBooleanAsStringValue() { @@ -297,8 +323,10 @@ class AttributeLimitTest extends TestCase $this->assertCount(0, $attributes); } + /** * Test for attribute value matching ignore case + * @return void */ public function testMatchAttributeValuesIgnoreCase() { @@ -337,8 +365,10 @@ class AttributeLimitTest extends TestCase $this->assertCount(0, $attributes); } + /** * Test for attribute value matching + * @return void */ public function testMatchAttributeValuesRegex() { @@ -434,11 +464,13 @@ class AttributeLimitTest extends TestCase ); } + /** * Test for allowed attributes not an array. * * This test is very unlikely and would require malformed metadata processing. * Cannot be generated via config options. + * @return void */ public function testMatchAttributeValuesNotArray() { @@ -465,8 +497,10 @@ class AttributeLimitTest extends TestCase self::processFilter($config, $request); } + /** * Test attributes not intersecting + * @return void */ public function testNoIntersection() { diff --git a/tests/modules/core/lib/Auth/Process/AttributeMapTest.php b/tests/modules/core/lib/Auth/Process/AttributeMapTest.php index c89dcbf89ca16b27cf91e69dd006583abd695723..878014a7838504075494deb978119e6163779403 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeMapTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeMapTest.php @@ -24,6 +24,9 @@ class AttributeMapTest extends TestCase } + /** + * @return void + */ public function testBasic() { $config = [ @@ -44,6 +47,10 @@ class AttributeMapTest extends TestCase $this->assertEquals($expected, $result); } + + /** + * @return void + */ public function testDuplicate() { $config = [ @@ -66,6 +73,10 @@ class AttributeMapTest extends TestCase $this->assertEquals($expected, $result); } + + /** + * @return void + */ public function testMultiple() { $config = [ @@ -87,6 +98,10 @@ class AttributeMapTest extends TestCase $this->assertEquals($expected, $result); } + + /** + * @return void + */ public function testMultipleDuplicate() { $config = [ @@ -110,6 +125,10 @@ class AttributeMapTest extends TestCase $this->assertEquals($expected, $result); } + + /** + * @return void + */ public function testCircular() { $config = [ @@ -133,6 +152,10 @@ class AttributeMapTest extends TestCase $this->assertEquals($expected, $result); } + + /** + * @return void + */ public function testMissingMap() { $config = [ @@ -155,6 +178,10 @@ class AttributeMapTest extends TestCase $this->assertEquals($expected, $result); } + + /** + * @return void + */ public function testInvalidOriginalAttributeType() { $config = [ @@ -170,6 +197,10 @@ class AttributeMapTest extends TestCase self::processFilter($config, $request); } + + /** + * @return void + */ public function testInvalidMappedAttributeType() { $config = [ @@ -185,6 +216,10 @@ class AttributeMapTest extends TestCase self::processFilter($config, $request); } + + /** + * @return void + */ public function testMissingMapFile() { $config = [ @@ -200,6 +235,10 @@ class AttributeMapTest extends TestCase self::processFilter($config, $request); } + + /** + * @return void + */ public function testOverwrite() { $config = [ @@ -221,6 +260,10 @@ class AttributeMapTest extends TestCase $this->assertEquals($expected, $result); } + + /** + * @return void + */ public function testOverwriteReversed() { $config = [ diff --git a/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php b/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php index 609b0c6437330680719cfbcf54ace95873764670..4b49708d61b402a5e3e5eed6047f1aea48f53e5c 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php @@ -9,7 +9,6 @@ use PHPUnit\Framework\TestCase; */ class AttributeRealmTest extends TestCase { - /** * Helper function to run the filter with a given configuration. * @@ -26,6 +25,7 @@ class AttributeRealmTest extends TestCase /** * Test the most basic functionality. + * @return void */ public function testBasic() { @@ -41,8 +41,10 @@ class AttributeRealmTest extends TestCase $this->assertEquals($attributes['realm'], ['example.org']); } + /** * Test no userid set + * @return void */ public function testNoUserID() { @@ -55,8 +57,10 @@ class AttributeRealmTest extends TestCase self::processFilter($config, $request); } + /** * Test with configuration. + * @return void */ public function testAttributeNameConfig() { @@ -77,8 +81,10 @@ class AttributeRealmTest extends TestCase $this->assertEquals($attributes['schacHomeOrganization'], ['example.org']); } + /** * When target attribute exists it will be overwritten + * @return void */ public function testTargetAttributeOverwritten() { @@ -99,8 +105,10 @@ class AttributeRealmTest extends TestCase $this->assertEquals($attributes['schacHomeOrganization'], ['example.org']); } + /** * When source attribute has no "@" no realm is added + * @return void */ public function testNoAtisNoOp() { @@ -116,8 +124,10 @@ class AttributeRealmTest extends TestCase $this->assertArrayNotHasKey('realm', $attributes); } + /** * When source attribute has more than one "@" no realm is added + * @return void */ public function testMultiAtisNoOp() { diff --git a/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php b/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php index 491638fe74193d227c8d31e640f2d36e5ccd8116..c3c153a4fd19616bb09497c91b59f0513e7ce4d0 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php @@ -10,7 +10,6 @@ use SimpleSAML\Module\core\Auth\Process\AttributeValueMap; */ class AttributeValueMapTest extends TestCase { - /** * Helper function to run the filter with a given configuration. * @@ -31,6 +30,7 @@ class AttributeValueMapTest extends TestCase * * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::__construct * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::process + * @return void */ public function testBasic() { @@ -62,6 +62,7 @@ class AttributeValueMapTest extends TestCase * * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::__construct * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::process + * @return void */ public function testNoDuplicates() { @@ -94,6 +95,7 @@ class AttributeValueMapTest extends TestCase * * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::__construct * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::process + * @return void */ public function testReplace() { @@ -127,6 +129,7 @@ class AttributeValueMapTest extends TestCase * * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::__construct * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::process + * @return void */ public function testKeep() { @@ -160,6 +163,7 @@ class AttributeValueMapTest extends TestCase * * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::__construct * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::process + * @return void */ public function testUnknownFlag() { @@ -190,6 +194,7 @@ class AttributeValueMapTest extends TestCase * * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::__construct * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::process + * @return void */ public function testMissingSourceAttribute() { @@ -216,6 +221,7 @@ class AttributeValueMapTest extends TestCase * * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::__construct * @covers SimpleSAML\Module\core\Auth\Process\AttributeValueMap::process + * @return void */ public function testMissingTargetAttribute() { diff --git a/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php b/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php index 7983886287b407da92412050b390d87a09f42a5e..f41317ef2f6f31da85c71d2e1d3943e42762caa5 100644 --- a/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php +++ b/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php @@ -9,6 +9,7 @@ class CardinalitySingleTest extends \PHPUnit\Framework\TestCase { private $http; + /** * Helper function to run the filter with a given configuration. * @@ -25,6 +26,10 @@ class CardinalitySingleTest extends \PHPUnit\Framework\TestCase return $request; } + + /** + * @return void + */ protected function setUp() { \SimpleSAML\Configuration::loadFromArray([], '[ARRAY]', 'simplesaml'); @@ -33,8 +38,10 @@ class CardinalitySingleTest extends \PHPUnit\Framework\TestCase ->getMock(); } + /** * Test singleValued + * @return void */ public function testSingleValuedUnchanged() { @@ -52,8 +59,10 @@ class CardinalitySingleTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expectedData, $attributes, "Assertion values should not have changed"); } + /** * Test first value extraction + * @return void */ public function testFirstValue() { @@ -71,6 +80,10 @@ class CardinalitySingleTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expectedData, $attributes, "Only first value should be returned"); } + + /** + * @return void + */ public function testFirstValueUnchanged() { $config = [ @@ -87,8 +100,10 @@ class CardinalitySingleTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expectedData, $attributes, "Assertion values should not have changed"); } + /** * Test flattening + * @return void */ public function testFlatten() { @@ -107,6 +122,10 @@ class CardinalitySingleTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expectedData, $attributes, "Flattened string should be returned"); } + + /** + * @return void + */ public function testFlattenUnchanged() { $config = [ @@ -124,8 +143,10 @@ class CardinalitySingleTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expectedData, $attributes, "Assertion values should not have changed"); } + /** * Test abort + * @return void */ public function testAbort() { diff --git a/tests/modules/core/lib/Auth/Process/CardinalityTest.php b/tests/modules/core/lib/Auth/Process/CardinalityTest.php index 5083383673c792c00ce00d2eec0a8ee9394f7cfc..433944f6b95f98d928ca5a61aaf5fdd869fae1c5 100644 --- a/tests/modules/core/lib/Auth/Process/CardinalityTest.php +++ b/tests/modules/core/lib/Auth/Process/CardinalityTest.php @@ -9,6 +9,7 @@ class CardinalityTest extends \PHPUnit\Framework\TestCase { private $http; + /** * Helper function to run the filter with a given configuration. * @@ -25,6 +26,10 @@ class CardinalityTest extends \PHPUnit\Framework\TestCase return $request; } + + /** + * @return void + */ protected function setUp() { \SimpleSAML\Configuration::loadFromArray([], '[ARRAY]', 'simplesaml'); @@ -33,8 +38,10 @@ class CardinalityTest extends \PHPUnit\Framework\TestCase ->getMock(); } - /* + + /** * Test where a minimum is set but no maximum + * @return void */ public function testMinNoMax() { @@ -52,8 +59,10 @@ class CardinalityTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expectedData, $attributes, "Assertion values should not have changed"); } - /* + + /** * Test where a maximum is set but no minimum + * @return void */ public function testMaxNoMin() { @@ -71,8 +80,10 @@ class CardinalityTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expectedData, $attributes, "Assertion values should not have changed"); } - /* + + /** * Test in bounds within a maximum an minimum + * @return void */ public function testMaxMin() { @@ -90,8 +101,10 @@ class CardinalityTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expectedData, $attributes, "Assertion values should not have changed"); } + /** * Test maximum is out of bounds results in redirect + * @return void */ public function testMaxOutOfBounds() { @@ -110,8 +123,10 @@ class CardinalityTest extends \PHPUnit\Framework\TestCase $this->processFilter($config, $request); } + /** * Test minimum is out of bounds results in redirect + * @return void */ public function testMinOutOfBounds() { @@ -130,8 +145,10 @@ class CardinalityTest extends \PHPUnit\Framework\TestCase $this->processFilter($config, $request); } + /** * Test missing attribute results in redirect + * @return void */ public function testMissingAttribute() { @@ -148,12 +165,15 @@ class CardinalityTest extends \PHPUnit\Framework\TestCase $this->processFilter($config, $request); } + /* * Configuration errors */ + /** * Test invalid minimum values + * @return void */ public function testMinInvalid() { @@ -170,8 +190,10 @@ class CardinalityTest extends \PHPUnit\Framework\TestCase $this->processFilter($config, $request); } + /** * Test invalid minimum values + * @return void */ public function testMinNegative() { @@ -188,8 +210,10 @@ class CardinalityTest extends \PHPUnit\Framework\TestCase $this->processFilter($config, $request); } + /** * Test invalid maximum values + * @return void */ public function testMaxInvalid() { @@ -206,8 +230,10 @@ class CardinalityTest extends \PHPUnit\Framework\TestCase $this->processFilter($config, $request); } + /** * Test maximum < minimum + * @return void */ public function testMinGreaterThanMax() { @@ -224,8 +250,10 @@ class CardinalityTest extends \PHPUnit\Framework\TestCase $this->processFilter($config, $request); } + /** * Test invalid attribute name + * @return void */ public function testInvalidAttributeName() { diff --git a/tests/modules/core/lib/Auth/Process/PHPTest.php b/tests/modules/core/lib/Auth/Process/PHPTest.php index 56745710a19c9359997cf8cd63d734158423e147..a7148af7dd754a1061ac20a26378d4deeee3885e 100644 --- a/tests/modules/core/lib/Auth/Process/PHPTest.php +++ b/tests/modules/core/lib/Auth/Process/PHPTest.php @@ -27,6 +27,7 @@ class PHPTest extends TestCase /** * Test the configuration of the filter. + * @return void */ public function testInvalidConfiguration() { @@ -41,6 +42,7 @@ class PHPTest extends TestCase /** * Check that defining the code works as expected. + * @return void */ public function testCodeDefined() { @@ -59,8 +61,10 @@ class PHPTest extends TestCase $this->assertEquals($expected, $this->processFilter($config, $request)); } + /** * Check that the incoming attributes are also available after processing + * @return void */ public function testPreserveIncomingAttributes() { @@ -87,9 +91,11 @@ class PHPTest extends TestCase $this->assertEquals($expected, $this->processFilter($config, $request)); } + /** * Check that throwing an Exception inside the PHP code of the * filter (a documented use case) works. + * @return void */ public function testThrowExceptionFromFilter() { @@ -114,8 +120,10 @@ class PHPTest extends TestCase $this->processFilter($config, $request); } + /** * Check that the entire state can be adjusted. + * @return void */ public function testStateCanBeModified() { diff --git a/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php b/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php index 52b29234c3029dcafda913c7673a8c6217395731..940542def5bf327a978f779464874edeb3eedbe8 100644 --- a/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php +++ b/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php @@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase; */ class ScopeAttributeTest extends TestCase { - /* + /** * Helper function to run the filter with a given configuration. * * @param array $config The filter configuration. @@ -23,8 +23,10 @@ class ScopeAttributeTest extends TestCase return $request; } - /* + + /** * Test the most basic functionality. + * @return void */ public function testBasic() { @@ -45,8 +47,10 @@ class ScopeAttributeTest extends TestCase $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['member@example.com']); } - /* + + /** * If target attribute already set, module must add, not overwrite. + * @return void */ public function testNoOverwrite() { @@ -70,8 +74,10 @@ class ScopeAttributeTest extends TestCase ); } - /* + + /** * If same scope already set, module must do nothing, not duplicate value. + * @return void */ public function testNoDuplication() { @@ -93,8 +99,9 @@ class ScopeAttributeTest extends TestCase } - /* + /** * If source attribute not set, nothing happens + * @return void */ public function testNoSourceAttribute() { @@ -114,8 +121,10 @@ class ScopeAttributeTest extends TestCase $this->assertEquals($request['Attributes'], $result['Attributes']); } - /* + + /** * If scope attribute not set, nothing happens + * @return void */ public function testNoScopeAttribute() { @@ -135,8 +144,10 @@ class ScopeAttributeTest extends TestCase $this->assertEquals($request['Attributes'], $result['Attributes']); } - /* + + /** * When multiple @ signs in attribute, will use the first one. + * @return void */ public function testMultiAt() { @@ -156,8 +167,10 @@ class ScopeAttributeTest extends TestCase $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['member@doe@example.com']); } - /* + + /** * When multiple values in source attribute, should render multiple targets. + * @return void */ public function testMultivaluedSource() { @@ -180,8 +193,10 @@ class ScopeAttributeTest extends TestCase ); } - /* + + /** * When the source attribute doesn't have a scope, the entire value is used. + * @return void */ public function testNoAt() { @@ -201,8 +216,10 @@ class ScopeAttributeTest extends TestCase $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['student@example.org']); } - /* + + /** * When the target attribute exists and onlyIfEmpty is set + * @return void */ public function testOnlyIfEmpty() { diff --git a/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php b/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php index a0abea39a7c0e1ae02383eb78cff579050cb6e77..365eee86a2bd351d5f49e6c7852d528af2a70d14 100644 --- a/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php +++ b/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php @@ -9,8 +9,7 @@ use PHPUnit\Framework\TestCase; */ class ScopeFromAttributeTest extends TestCase { - - /* + /** * Helper function to run the filter with a given configuration. * * @param array $config The filter configuration. @@ -24,8 +23,10 @@ class ScopeFromAttributeTest extends TestCase return $request; } - /* + + /** * Test the most basic functionality. + * @return void */ public function testBasic() { @@ -44,8 +45,10 @@ class ScopeFromAttributeTest extends TestCase $this->assertEquals($attributes['scope'], ['example.com']); } - /* + + /** * If scope already set, module must not overwrite. + * @return void */ public function testNoOverwrite() { @@ -64,8 +67,10 @@ class ScopeFromAttributeTest extends TestCase $this->assertEquals($attributes['scope'], ['example.edu']); } - /* + + /** * If source attribute not set, nothing happens + * @return void */ public function testNoSourceAttribute() { @@ -83,8 +88,10 @@ class ScopeFromAttributeTest extends TestCase $this->assertEquals($request['Attributes'], $result['Attributes']); } - /* + + /** * When multiple @ signs in attribute, should use last one. + * @return void */ public function testMultiAt() { @@ -102,8 +109,10 @@ class ScopeFromAttributeTest extends TestCase $this->assertEquals($attributes['scope'], ['example.com']); } - /* + + /** * When the source attribute doesn't have a scope, a warning is emitted + * @return void */ public function testNoAt() { diff --git a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php index 33089c033681c86331ad40e1bde26fffea631f2c..c4387bcb99c6d2bebad19718db7534ccdfdf4d0a 100644 --- a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php +++ b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php @@ -23,8 +23,10 @@ class TargetedIDTest extends TestCase return $request; } + // /** // * Test the most basic functionality +// * @return void // */ // public function testBasic() // { @@ -39,9 +41,11 @@ class TargetedIDTest extends TestCase // $this->assertRegExp('/^[0-9a-f]{40}$/', $attributes['eduPersonTargetedID'][0]); // } // +// // /** // * Test with src and dst entityIds. // * Make sure to overwrite any present eduPersonTargetedId +// * @return void // */ // public function testWithSrcDst() // { @@ -66,8 +70,10 @@ class TargetedIDTest extends TestCase // $this->assertRegExp('/^[0-9a-f]{40}$/', $attributes['eduPersonTargetedID'][0]); // } // +// // /** // * Test with nameId config option set. +// * @return void // */ // public function testNameIdGeneration() // { @@ -95,8 +101,10 @@ class TargetedIDTest extends TestCase // ); // } // +// // /** // * Test that Id is the same for subsequent invocations with same input. +// * @return void // */ // public function testIdIsPersistent() // { @@ -126,8 +134,10 @@ class TargetedIDTest extends TestCase // } // } // +// // /** // * Test that Id is different for two different usernames and two different sp's +// * @return void // */ // public function testIdIsUnique() // { @@ -160,8 +170,10 @@ class TargetedIDTest extends TestCase // $this->assertNotEquals($tid2, $tid3); // } + /** * Test no userid set + * @return void */ public function testNoUserID() { @@ -173,8 +185,10 @@ class TargetedIDTest extends TestCase self::processFilter($config, $request); } + /** * Test with specified attribute not set + * @return void */ public function testAttributeNotExists() { @@ -190,8 +204,10 @@ class TargetedIDTest extends TestCase self::processFilter($config, $request); } + /** * Test with configuration error 1 + * @return void */ public function testConfigInvalidAttributeName() { @@ -207,8 +223,10 @@ class TargetedIDTest extends TestCase self::processFilter($config, $request); } + /** * Test with configuration error 2 + * @return void */ public function testConfigInvalidNameId() { diff --git a/tests/modules/core/lib/Auth/UserPassBaseTest.php b/tests/modules/core/lib/Auth/UserPassBaseTest.php index a6715df988f00a342288d358ee1139c699ad7a75..51007e89c6a049abf3b993237096df3e659872c6 100644 --- a/tests/modules/core/lib/Auth/UserPassBaseTest.php +++ b/tests/modules/core/lib/Auth/UserPassBaseTest.php @@ -4,6 +4,9 @@ namespace SimpleSAML\Test\Module\core\Auth; class UserPassBaseTest extends \PHPUnit\Framework\TestCase { + /** + * @return void + */ public function testAuthenticateECPCallsLoginAndSetsAttributes() { $state = [ @@ -30,6 +33,9 @@ class UserPassBaseTest extends \PHPUnit\Framework\TestCase } + /** + * @return void + */ public function testAuthenticateECPMissingUsername() { $this->expectException(\SimpleSAML\Error\Error::class, 'WRONGUSERPASS'); @@ -49,6 +55,9 @@ class UserPassBaseTest extends \PHPUnit\Framework\TestCase } + /** + * @return void + */ public function testAuthenticateECPMissingPassword() { $this->expectException(\SimpleSAML\Error\Error::class, 'WRONGUSERPASS'); @@ -68,6 +77,9 @@ class UserPassBaseTest extends \PHPUnit\Framework\TestCase } + /** + * @return void + */ public function testAuthenticateECPCallsLoginWithForcedUsername() { $state = [ diff --git a/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php b/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php index e3a091cefc132a5aca0ea91bbff73f8952368f20..05a1a7ffd9a8c217cb60bb3fd8d0ade62c467561 100644 --- a/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php +++ b/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php @@ -6,6 +6,9 @@ use SimpleSAML\Module\core\Auth\UserPassOrgBase; class UserPassOrgBaseTest extends \PHPUnit\Framework\TestCase { + /** + * @return void + */ public function testRememberOrganizationEnabled() { $config = [ diff --git a/tests/modules/core/lib/ControllerTest.php b/tests/modules/core/lib/ControllerTest.php index f85225a28d8b8a24cca06240362a6d66c78d64b4..b1125481f6aa742be45c9b80b7c2fcdf3179405c 100644 --- a/tests/modules/core/lib/ControllerTest.php +++ b/tests/modules/core/lib/ControllerTest.php @@ -26,7 +26,6 @@ use Symfony\Component\HttpFoundation\Request; */ class ControllerTest extends ClearStateTestCase { - /** @var array */ protected $authSources; @@ -42,6 +41,7 @@ class ControllerTest extends ClearStateTestCase /** * Set up for each test. + * @return void */ protected function setUp() { @@ -73,6 +73,7 @@ class ControllerTest extends ClearStateTestCase /** * Test that authentication is started immediately if we hit the login endpoint and there's only one non-admin * source configured. + * @return void */ public function testAutomaticLoginWhenOnlyOneSource() { @@ -95,6 +96,7 @@ class ControllerTest extends ClearStateTestCase /** * Test that the user can choose what auth source to use when there are multiple defined (admin excluded). + * @return void */ public function testMultipleAuthSources() { @@ -126,6 +128,7 @@ class ControllerTest extends ClearStateTestCase /** * Test that specifying an invalid auth source while trying to login raises an exception. + * @return void */ public function testLoginWithInvalidAuthSource() { @@ -143,6 +146,7 @@ class ControllerTest extends ClearStateTestCase /** * Test that we get redirected to /account/authsource when accessing the login endpoint while being already * authenticated. + * @return void */ public function testLoginWhenAlreadyAuthenticated() { @@ -176,6 +180,7 @@ class ControllerTest extends ClearStateTestCase /** * Test that triggering the logout controller actually proceeds to log out from the specified source. + * @return void */ public function testLogout() { @@ -196,6 +201,7 @@ class ControllerTest extends ClearStateTestCase /** * Test that accessing the "account" endpoint without being authenticated gets you redirected to the "login" * endpoint. + * @return void */ public function testNotAuthenticated() { @@ -216,6 +222,7 @@ class ControllerTest extends ClearStateTestCase /** * Test that we are presented with a regular page if we are authenticated and try to access the "account" endpoint. + * @return void */ public function testAuthenticated() { diff --git a/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php b/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php index 1d8f4d700006abf1c780d938902aae6cea14a498..e073b6e5bc566dbe89a1177fef31e3c1dfe19c5c 100644 --- a/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php +++ b/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php @@ -11,6 +11,10 @@ class SQLPermanentStorageTest extends TestCase { private static $sql; + + /** + * @return void + */ public static function setUpBeforeClass() { // Create instance @@ -20,12 +24,20 @@ class SQLPermanentStorageTest extends TestCase self::$sql = new \SimpleSAML\Module\core\Storage\SQLPermanentStorage('test', $config); } + + /** + * @return void + */ public static function tearDownAfterClass() { self::$sql = null; unlink(sys_get_temp_dir().'/sqllite/test.sqlite'); } + + /** + * @return void + */ public function testSet() { // Set a new value @@ -36,6 +48,10 @@ class SQLPermanentStorageTest extends TestCase $this->assertEquals('testvalue', $result['value']); } + + /** + * @return void + */ public function testSetOverwrite() { // Overwrite existing value @@ -49,6 +65,10 @@ class SQLPermanentStorageTest extends TestCase $this->assertEquals('testvaluemodified', $result[0]['value']); } + + /** + * @return void + */ public function testNonexistentKey() { // Test that getting some non-existing key will return null @@ -60,6 +80,10 @@ class SQLPermanentStorageTest extends TestCase $this->assertNull($result); } + + /** + * @return void + */ public function testExpiration() { // Make sure the earlier created entry has expired now @@ -78,6 +102,10 @@ class SQLPermanentStorageTest extends TestCase $this->assertEquals('testvalue_nonexpiring', $result); } + + /** + * @return void + */ public function testRemove() { // Now remove the nonexpiring entry and make sure it's gone diff --git a/tests/modules/multiauth/lib/Auth/Source/MultiAuthTest.php b/tests/modules/multiauth/lib/Auth/Source/MultiAuthTest.php index 632fca86235f51638ada02e473deffea78029cba..e9eeabd42085782a89da2dd1e00efd02f64eb745 100644 --- a/tests/modules/multiauth/lib/Auth/Source/MultiAuthTest.php +++ b/tests/modules/multiauth/lib/Auth/Source/MultiAuthTest.php @@ -11,6 +11,10 @@ class MultiAuthTest extends \SimpleSAML\Test\Utils\ClearStateTestCase /** @var Configuration */ private $sourceConfig; + + /** + * @return void + */ public function setUp() { $this->config = Configuration::loadFromArray(['module.enable' => ['multiauth' => true]], '[ARRAY]', 'simplesaml'); @@ -55,7 +59,9 @@ class MultiAuthTest extends \SimpleSAML\Test\Utils\ClearStateTestCase Configuration::setPreLoadedConfig($this->sourceConfig, 'authsources.php'); } + /** + * @return void */ public function testSourcesMustBePresent() { @@ -72,7 +78,9 @@ class MultiAuthTest extends \SimpleSAML\Test\Utils\ClearStateTestCase new MultiAuth(['AuthId' => 'example-multi'], $sourceConfig->getArray('example-multi')); } + /** + * @return void */ public function testPreselectMustBeValid() { @@ -119,6 +127,10 @@ class MultiAuthTest extends \SimpleSAML\Test\Utils\ClearStateTestCase new MultiAuth(['AuthId' => 'example-multi'], $sourceConfig->getArray('example-multi')); } + + /** + * @return void + */ public function testPreselectIsOptional() { $sourceConfig = Configuration::loadFromArray(array( @@ -171,6 +183,10 @@ class MultiAuthTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertArrayNotHasKey('multiauth:preselect', $state); } + + /** + * @return void + */ public function testPreselectCanBeConfigured() { $state = []; @@ -186,6 +202,10 @@ class MultiAuthTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals('example-saml', $state['multiauth:preselect']); } + + /** + * @return void + */ public function testStatePreselectHasPriority() { $state = ['multiauth:preselect' => 'example-admin']; diff --git a/tests/modules/saml/lib/Auth/Process/FilterScopesTest.php b/tests/modules/saml/lib/Auth/Process/FilterScopesTest.php index 20e9400b6dd685c233181a8da2f3fd8352e70192..b81579982de7a3704eb65fef07afe5bcf28004b3 100644 --- a/tests/modules/saml/lib/Auth/Process/FilterScopesTest.php +++ b/tests/modules/saml/lib/Auth/Process/FilterScopesTest.php @@ -12,8 +12,7 @@ use PHPUnit\Framework\TestCase; class FilterScopesTest extends TestCase { - - /* + /** * Helper function to run the filter with a given configuration. * * @param array $config The filter configuration. @@ -30,6 +29,7 @@ class FilterScopesTest extends TestCase /** * Test valid scopes. + * @return void */ public function testValidScopes() { @@ -91,6 +91,7 @@ class FilterScopesTest extends TestCase /** * Test invalid scopes. + * @return void */ public function testInvalidScopes() { diff --git a/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php b/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php index 333523302a8fa76679ff1c272c4da86ad34c1a99..12b2bbcd259675ea1cd7e1b5a4d27f8693b7b5d0 100644 --- a/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php +++ b/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php @@ -17,8 +17,7 @@ use SAML2\Constants; class NameIDAttributeTest extends TestCase { - - /* + /** * Helper function to run the filter with a given configuration. * * @param array $config The filter configuration. @@ -35,6 +34,7 @@ class NameIDAttributeTest extends TestCase /** * Test minimal configuration. + * @return void */ public function testMinimalConfig() { @@ -62,8 +62,10 @@ class NameIDAttributeTest extends TestCase $this->assertEquals("{$spId}!{$idpId}!{$nameId->getValue()}", $result['Attributes']['nameid'][0]); } + /** * Test custom attribute name. + * @return void */ public function testCustomAttributeName() { @@ -92,8 +94,10 @@ class NameIDAttributeTest extends TestCase $this->assertEquals("{$spId}!{$idpId}!{$nameId->getValue()}", $result['Attributes'][$attributeName][0]); } + /** * Test custom format. + * @return void */ public function testFormat() { @@ -123,6 +127,7 @@ class NameIDAttributeTest extends TestCase /** * Test custom attribute name with format. + * @return void */ public function testCustomAttributeNameAndFormat() { 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 b9b275501774ef2e2ff6f2657f7ce25941d623c1..aed55681f96895f0f2d2fa085345527ae241d1d1 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 @@ -19,6 +19,9 @@ class ExitTestException extends \Exception private $testResult; + /** + * @return void + */ public function __construct($testResult) { parent::__construct("ExitTestException", 0, null); @@ -26,6 +29,9 @@ class ExitTestException extends \Exception } + /** + * @return array + */ public function getTestResult() { return $this->testResult; @@ -40,13 +46,18 @@ class ExitTestException extends \Exception */ class SPTester extends \SimpleSAML\Module\saml\Auth\Source\SP { - + /** + * @return void + */ public function __construct($info, $config) { parent::__construct($info, $config); } + /** + * @return void + */ public function startSSO2Test(Configuration $idpMetadata, array $state) { $reflector = new \ReflectionObject($this); @@ -56,7 +67,10 @@ class SPTester extends \SimpleSAML\Module\saml\Auth\Source\SP } - // override the method that sends the request to avoid sending anything + /** + * override the method that sends the request to avoid sending anything + * @return void + */ public function sendSAML2AuthnRequest(array &$state, \SAML2\Binding $binding, \SAML2\AuthnRequest $ar) { // Exit test. Continuing would mean running into a assert(FALSE) @@ -76,12 +90,14 @@ class SPTester extends \SimpleSAML\Module\saml\Auth\Source\SP */ class SPTest extends ClearStateTestCase { - private $idpMetadata = null; private $idpConfigArray; + /** + * @return \SimpleSAML\Configuration + */ private function getIdpMetadata() { if (!$this->idpMetadata) { @@ -95,6 +111,9 @@ class SPTest extends ClearStateTestCase } + /** + * @return void + */ protected function setUp() { parent::setUp(); @@ -166,6 +185,7 @@ class SPTest extends ClearStateTestCase /** * Test generating an AuthnRequest * @test + * @return void */ public function testAuthnRequest() { @@ -190,7 +210,8 @@ class SPTest extends ClearStateTestCase /** * Test setting a Subject - * @test * + * @test + * @return void */ public function testNameID() { @@ -222,7 +243,8 @@ class SPTest extends ClearStateTestCase /** * Test setting an AuthnConextClassRef - * @test * + * @test + * @return void */ public function testAuthnContextClassRef() { @@ -251,7 +273,8 @@ class SPTest extends ClearStateTestCase /** * Test setting ForcedAuthn - * @test * + * @test + * @return void */ public function testForcedAuthn() { @@ -276,8 +299,10 @@ class SPTest extends ClearStateTestCase ); } + /** * Test specifying an IDPList where no metadata found for those idps is an error + * @return void */ public function testIdpListWithNoMatchingMetadata() { @@ -292,8 +317,10 @@ class SPTest extends ClearStateTestCase $as->authenticate($state); } + /** * Test specifying an IDPList where the list does not overlap with the Idp specified in SP config is an error + * @return void */ public function testIdpListWithExplicitIdpNotMatch() { @@ -318,8 +345,10 @@ class SPTest extends ClearStateTestCase $as->authenticate($state); } + /** * Test that IDPList overlaps with the IDP specified in SP config results in AuthnRequest + * @return void */ public function testIdpListWithExplicitIdpMatch() { @@ -356,8 +385,10 @@ class SPTest extends ClearStateTestCase } } + /** * Test that IDPList with a single valid idp and no SP config idp results in AuthnRequest to that idp + * @return void */ public function testIdpListWithSingleMatch() { @@ -392,8 +423,10 @@ class SPTest extends ClearStateTestCase } } + /** * Test that IDPList with multiple valid idp and no SP config idp results in discovery redirect + * @return void */ public function testIdpListWithMultipleMatch() { diff --git a/tests/modules/saml/lib/IdP/SAML2Test.php b/tests/modules/saml/lib/IdP/SAML2Test.php index a79ae36b6a75f6e5bbdfbe8af6decc72d86b09f3..ebce96d27d7255203d4ec82519e5b6871d8f12f3 100644 --- a/tests/modules/saml/lib/IdP/SAML2Test.php +++ b/tests/modules/saml/lib/IdP/SAML2Test.php @@ -28,10 +28,13 @@ class SAML2Test extends ClearStateTestCase 'saml:NameIDFormat' => null, 'saml:AllowCreate' => true, 'saml:Extensions' => null, - 'saml:RequestedAuthnContext' => null]; + 'saml:RequestedAuthnContext' => null + ]; + /** * Test that invoking the idp initiated endpoint with the minimum necessary parameters works. + * @return void */ public function testIdPInitiatedLoginMinimumParams() { @@ -53,8 +56,10 @@ class SAML2Test extends ClearStateTestCase $this->assertEquals($expectedState, $state); } + /** * Test that invoking the idp initiated endpoint with the optional parameters works. + * @return void */ public function testIdPInitiatedLoginOptionalParams() { @@ -86,8 +91,10 @@ class SAML2Test extends ClearStateTestCase $this->assertEquals($expectedState, $state); } + /** * Test that invoking the idp initiated endpoint using minimum shib params works + * @return void */ public function testIdPInitShibCompatyMinimumParams() { @@ -111,8 +118,10 @@ class SAML2Test extends ClearStateTestCase $this->assertEquals($expectedState, $state); } + /** * Test that invoking the idp initiated endpoint using minimum shib params works + * @return void */ public function testIdPInitShibCompatOptionalParams() { @@ -141,6 +150,7 @@ class SAML2Test extends ClearStateTestCase $this->assertEquals($expectedState, $state); } + /** * Invoke IDP initiated login with the given query parameters. * Callers should validate the return state array or confirm appropriate exceptions are returned. diff --git a/tests/www/IndexTest.php b/tests/www/IndexTest.php index 4e4326c6bbc3209349e400fd852c2695944564e7..e0da79a34025a42fc6fa173e56ea92ff56c71e60 100644 --- a/tests/www/IndexTest.php +++ b/tests/www/IndexTest.php @@ -41,6 +41,7 @@ class IndexTest extends TestCase /** * The setup method that is run before any tests in this class. + * @return void */ protected function setup() { @@ -53,6 +54,9 @@ class IndexTest extends TestCase } + /** + * @return void + */ protected function updateConfig($config) { @unlink($this->shared_file); @@ -63,6 +67,7 @@ class IndexTest extends TestCase /** * A simple test to make sure the index.php file redirects appropriately to the right URL. + * @return void */ public function testRedirection() { @@ -109,6 +114,7 @@ class IndexTest extends TestCase /** * The tear down method that is executed after all tests in this class. + * @return void */ protected function tearDown() { diff --git a/tests/www/RouterTest.php b/tests/www/RouterTest.php index d653b1b1d6d824e6f571fba2cd5a311530148d20..c872bfb07f2bddda8e9e783bc53f7c7d1a4d066d 100644 --- a/tests/www/RouterTest.php +++ b/tests/www/RouterTest.php @@ -2,14 +2,17 @@ namespace SimpleSAML\Test\Web; +use PHPUnit\Framework\TestCase; +use SimpleSAML\Configuration; +use SimpleSAML\Module; use Symfony\Component\Yaml\Parser; use Symfony\Component\Yaml\Exception\ParseException; -use PHPUnit\Framework\TestCase; -use \SimpleSAML\Configuration; -use \SimpleSAML\Module; class RouterTest extends TestCase { + /** + * @return void + */ public function testSyntax() { $config = Configuration::loadFromArray([ diff --git a/tests/www/TemplateTest.php b/tests/www/TemplateTest.php index 8eed3e7b86c95ba6f91dcc8197d33a11b8a90fdc..3a8f2cd6d764a1a55c049ae6c3000c9c59b58d4b 100644 --- a/tests/www/TemplateTest.php +++ b/tests/www/TemplateTest.php @@ -16,6 +16,9 @@ use Twig\Error\SyntaxError; class TemplateTest extends TestCase { + /** + * @return void + */ public function testSyntax() { $config = Configuration::loadFromArray([