diff --git a/tests/autoloader_test.php b/tests/autoloader_test.php index 33f714e27..03cb637b9 100644 --- a/tests/autoloader_test.php +++ b/tests/autoloader_test.php @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +namespace auth_saml2; + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../_autoload.php'); @@ -26,14 +28,14 @@ * @copyright 2018 Catalyst IT Australia {@link http://www.catalyst-au.net} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class autoloader_test extends advanced_testcase { +final class autoloader_test extends \advanced_testcase { public function test_it_loads_classes(): void { $classes = [ \Psr\Log\LoggerInterface::class, \SAML2\Utils::class, \SimpleSAML\Configuration::class, \RobRichards\XMLSecLibs\XMLSecEnc::class, - Twig\Loader\FilesystemLoader::class, + \Twig\Loader\FilesystemLoader::class, ]; foreach ($classes as $class) { $found = class_exists($class) || interface_exists($class); diff --git a/tests/form_regenerate_test.php b/tests/form_regenerate_test.php index 11cce156e..f13b330a1 100644 --- a/tests/form_regenerate_test.php +++ b/tests/form_regenerate_test.php @@ -14,23 +14,17 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * auth_saml2 create/edit page unit tests - * - * @package auth_saml2 - * @copyright Catalyst IT Australia {@link http://www.catalyst-au.net} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ +namespace auth_saml2; use auth_saml2\form\regenerate; /** * auth_saml2 form submission unit tests - * * @package auth_saml2 + * @copyright Catalyst IT Australia {@link http://www.catalyst-au.net} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class form_regenerate_test extends advanced_testcase { +final class form_regenerate_test extends \advanced_testcase { public function test_regenerate_certificate_form(): void { global $CFG, $DB, $USER; $this->resetAfterTest(); diff --git a/tests/generator_test.php b/tests/generator_test.php index 88ceede34..a1530fc30 100644 --- a/tests/generator_test.php +++ b/tests/generator_test.php @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +namespace auth_saml2; /** * Unit tests for test data generator. diff --git a/tests/group_rule_test.php b/tests/group_rule_test.php index de7e0e5a4..324c93d93 100644 --- a/tests/group_rule_test.php +++ b/tests/group_rule_test.php @@ -14,23 +14,17 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Testcase class for group_rule class. - * - * @package auth_saml2 - * @author Dmitrii Metelkin - * @copyright Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ +namespace auth_saml2; /** * Testcase class for group_rule class. * * @package auth_saml2 + * @author Dmitrii Metelkin * @copyright Catalyst IT * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class group_rule_test extends advanced_testcase { +final class group_rule_test extends \advanced_testcase { /** * Test we can get list of rules from config string. diff --git a/tests/locallib_test.php b/tests/locallib_test.php index 9e6802297..3508122e2 100644 --- a/tests/locallib_test.php +++ b/tests/locallib_test.php @@ -14,16 +14,9 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * SAML2 SP metadata tests. - * - * @package auth_saml2 - * @copyright Brendan Heywood - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ +namespace auth_saml2; -use auth_saml2\admin\saml2_settings; -use auth_saml2\admin\setting_idpmetadata; +use SimpleXMLElement; defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../locallib.php'); @@ -31,10 +24,11 @@ /** * Tests for SAML * + * @package auth_saml2 * @copyright Brendan Heywood * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class locallib_test extends advanced_testcase { +final class locallib_test extends \advanced_testcase { /** * Regression test for Issue 132. */ diff --git a/tests/metadata_fetcher_test.php b/tests/metadata_fetcher_test.php index d20057183..1cfa2dcd3 100644 --- a/tests/metadata_fetcher_test.php +++ b/tests/metadata_fetcher_test.php @@ -14,24 +14,17 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Testcase class for metadata_fetcher class. - * - * @package auth_saml2 - * @author Sam Chaffee - * @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -use auth_saml2\metadata_fetcher; +namespace auth_saml2; /** * Testcase class for metadata_fetcher class. * * @package auth_saml2 + * @author Sam Chaffee * @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class metadata_fetcher_test extends advanced_testcase { +final class metadata_fetcher_test extends \advanced_testcase { /** @var \Prophecy\Prophet */ protected $prophet; diff --git a/tests/metadata_parser_test.php b/tests/metadata_parser_test.php index 49b38c422..33e1c40b1 100644 --- a/tests/metadata_parser_test.php +++ b/tests/metadata_parser_test.php @@ -14,24 +14,17 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Testcase class for metadata_parser class. - * - * @package auth_saml2 - * @author Sam Chaffee - * @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -use auth_saml2\metadata_parser; +namespace auth_saml2; /** * Testcase class for metadata_parser class. * * @package auth_saml2 + * @author Sam Chaffee * @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class metadata_parser_test extends basic_testcase { +final class metadata_parser_test extends \basic_testcase { public function test_parse_metadata(): void { $xml = file_get_contents(__DIR__ . '/fixtures/metadata.xml'); diff --git a/tests/metadata_refresh_test.php b/tests/metadata_refresh_test.php index 89413403c..604f596dc 100644 --- a/tests/metadata_refresh_test.php +++ b/tests/metadata_refresh_test.php @@ -14,14 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Testcase class for metadata_refresh task class. - * - * @package auth_saml2 - * @author Sam Chaffee - * @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ +namespace auth_saml2; use auth_saml2\task\metadata_refresh; @@ -29,10 +22,11 @@ * Testcase class for metadata_refresh task class. * * @package auth_saml2 + * @author Sam Chaffee * @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class metadata_refresh_test extends advanced_testcase { +final class metadata_refresh_test extends \advanced_testcase { /** @var \Prophecy\Prophet */ protected $prophet; diff --git a/tests/metadata_writer_test.php b/tests/metadata_writer_test.php index 4e561f7e9..67ae660e1 100644 --- a/tests/metadata_writer_test.php +++ b/tests/metadata_writer_test.php @@ -14,24 +14,17 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Testcase class for metadata_writer class. - * - * @package auth_saml2 - * @author Sam Chaffee - * @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -use auth_saml2\metadata_writer; +namespace auth_saml2; /** * Testcase class for metadata_writer class. * * @package auth_saml2 + * @author Sam Chaffee * @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class metadata_writer_test extends basic_testcase { +final class metadata_writer_test extends \basic_testcase { public function test_write_default_path(): void { global $CFG; diff --git a/tests/redis_store_test.php b/tests/redis_store_test.php index 203b59519..76d16dc00 100644 --- a/tests/redis_store_test.php +++ b/tests/redis_store_test.php @@ -14,24 +14,17 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Testcase class for auth/saml2 Redis store. - * - * @package auth_saml2 - * @author Sam Chaffee - * @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -use auth_saml2\redis_store; +namespace auth_saml2; /** * Testcase class for auth/saml2 Redis store. * * @package auth_saml2 + * @author Sam Chaffee * @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class redis_store_test extends advanced_testcase { +final class redis_store_test extends \advanced_testcase { /** * @var null|\Redis diff --git a/tests/saml2_sitedata_test.php b/tests/saml2_sitedata_test.php index 9c1e66b10..ae9848219 100644 --- a/tests/saml2_sitedata_test.php +++ b/tests/saml2_sitedata_test.php @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +namespace auth_saml2; + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../_autoload.php'); @@ -26,7 +28,7 @@ * @copyright 2018 Catalyst IT Australia {@link http://www.catalyst-au.net} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class saml2_sitedata_test extends advanced_testcase { +final class saml2_sitedata_test extends \advanced_testcase { public function test_it_creates_the_directory_if_it_does_not_exist(): void { global $CFG; diff --git a/tests/setting_idpmetadata_test.php b/tests/setting_idpmetadata_test.php index de9f03b85..c385ad0d1 100644 --- a/tests/setting_idpmetadata_test.php +++ b/tests/setting_idpmetadata_test.php @@ -14,8 +14,9 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +namespace auth_saml2; + use auth_saml2\admin\setting_idpmetadata; -use auth_saml2\idp_data; defined('MOODLE_INTERNAL') || die(); @@ -29,7 +30,7 @@ * @copyright 2018 Catalyst IT Australia {@link http://www.catalyst-au.net} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class setting_idpmetadata_test extends advanced_testcase { +final class setting_idpmetadata_test extends \advanced_testcase { /** @var setting_idpmetadata */ private static $config; diff --git a/tests/simplesamlphp_upgrade_test.php b/tests/simplesamlphp_upgrade_test.php index ec307595e..152f3c13b 100644 --- a/tests/simplesamlphp_upgrade_test.php +++ b/tests/simplesamlphp_upgrade_test.php @@ -14,21 +14,16 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * auth_saml2 SimpleSAMLphp upgrade unit tests - * - * @package auth_saml2 - * @copyright Catalyst IT Australia {@link http://www.catalyst-au.net} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ +namespace auth_saml2; /** * auth_saml2 SimpleSAMLphp upgrade unit tests * * @package auth_saml2 + * @copyright Catalyst IT Australia {@link http://www.catalyst-au.net} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class simplesamlphp_upgrade_test extends advanced_testcase { +final class simplesamlphp_upgrade_test extends \advanced_testcase { /** * Test to ensure that composer files are removed from compiled extlib/simplesamlphp. diff --git a/tests/ssl_algorithm_test.php b/tests/ssl_algorithm_test.php index d5993334d..480406913 100644 --- a/tests/ssl_algorithm_test.php +++ b/tests/ssl_algorithm_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -use auth_saml2\ssl_algorithms; +namespace auth_saml2; /** * Test Saml2 SSL Algorithms. @@ -24,7 +24,7 @@ * @copyright Catalyst IT * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class ssl_algorithm_test extends basic_testcase { +final class ssl_algorithm_test extends \basic_testcase { public function test_default_saml_signature_algorithm_is_valid_saml_signature_algorithm(): void { $this->assertTrue(array_key_exists(ssl_algorithms::get_default_saml_signature_algorithm(), ssl_algorithms::get_valid_saml_signature_algorithms())); diff --git a/tests/user_extractor_test.php b/tests/user_extractor_test.php index 728608987..2eef10b4d 100644 --- a/tests/user_extractor_test.php +++ b/tests/user_extractor_test.php @@ -14,16 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Test for user extractor class. - * - * @package auth_saml2 - * @author Dmitrii Metelkin - * @copyright 2021 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -use auth_saml2\user_extractor; +namespace auth_saml2; /** * Test for user extractor class. @@ -33,7 +24,7 @@ * @copyright 2021 Catalyst IT * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class user_extractor_test extends advanced_testcase { +final class user_extractor_test extends \advanced_testcase { /** * A helper function to create a custom profile field. @@ -44,7 +35,7 @@ final class user_extractor_test extends advanced_testcase { * * @return \stdClass */ - protected function add_user_profile_field(string $shortname, string $datatype, bool $unique = false): stdClass { + protected function add_user_profile_field(string $shortname, string $datatype, bool $unique = false): \stdClass { global $DB; // Create a new profile field. diff --git a/tests/user_fields_test.php b/tests/user_fields_test.php index 6c9901212..2dfb68395 100644 --- a/tests/user_fields_test.php +++ b/tests/user_fields_test.php @@ -14,16 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Test for user fields class. - * - * @package auth_saml2 - * @author Dmitrii Metelkin - * @copyright 2021 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -use auth_saml2\user_fields; +namespace auth_saml2; /** * Test for user fields class. @@ -33,7 +24,7 @@ * @copyright 2021 Catalyst IT * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -final class user_fields_test extends advanced_testcase { +final class user_fields_test extends \advanced_testcase { /** * A helper function to create a custom profile field. @@ -44,7 +35,7 @@ final class user_fields_test extends advanced_testcase { * * @return \stdClass */ - protected function add_user_profile_field(string $shortname, string $datatype, bool $unique = false): stdClass { + protected function add_user_profile_field(string $shortname, string $datatype, bool $unique = false): \stdClass { global $DB; // Create a new profile field.