From 0ed53be9b2c37643732d9a14182ed6f835e6bc89 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Mon, 26 Sep 2022 10:57:24 +0200 Subject: [PATCH] MDL-66902 tests: Fix all incorrect namespaces This issue just goes over all the currently incorrect namespaces in test cases and: 1. Change the namespace to the correct one. 2. Move/rename it to correct location if needed (level 2 and down). 3. Remove not needed MOODLE_INTERNAL check when possible. 4. Remove file phpdoc when the file only has one class. 5. Make small adjustments in case the change of namespace requires it. --- .../{ => local/tool}/activityresults_test.php | 0 .../{ => local/tool}/checktyperesults_test.php | 0 .../tests/{ => local/tool}/errors_test.php | 0 .../tests/{ => local/tool}/printable_test.php | 0 .../httpsreplace/tests/httpsreplace_test.php | 3 +-- .../{ => local}/import_handler_info_test.php | 17 ++++++----------- .../import_handler_registry_test.php | 17 ++++++----------- .../tests/{ => local}/import_info_test.php | 17 ++++++----------- .../tests/{ => local}/import_processor_test.php | 17 ++++++----------- .../tests/{ => local}/remote_resource_test.php | 17 ++++++----------- .../moodlenet/tests/{ => local}/url_test.php | 15 +++++---------- .../tests/accessibility_review_test.php | 2 +- blocks/badges/tests/badges_test.php | 2 +- blocks/blog_menu/tests/blog_menu_test.php | 2 +- blocks/blog_recent/tests/blog_recent_test.php | 2 +- blocks/blog_tags/tests/blog_tags_test.php | 2 +- blocks/comments/tests/comments_test.php | 2 +- .../tests/completionstatus_test.php | 2 +- blocks/globalsearch/tests/globalsearch_test.php | 2 +- .../tests/glossary_random_test.php | 2 +- blocks/lp/tests/lp_test.php | 2 +- blocks/mnet_hosts/tests/mnet_hosts_test.php | 2 +- blocks/tags/tests/tags_test.php | 2 +- .../{ => output/local/state}/state_test.php | 3 +-- course/tests/course_delete_modules_test.php | 4 +--- course/tests/notifications_test.php | 2 +- .../add_instances_test.php} | 2 +- .../delete_instances_test.php} | 2 +- .../gradingpanel/external/fetch_test.php} | 11 +---------- .../gradingpanel/external/store_test.php} | 11 +---------- .../gradingpanel/external/fetch_test.php} | 11 +---------- .../gradingpanel/external/store_test.php} | 11 +---------- grade/tests/component_gradeitems_test.php | 2 +- .../gradingpanel/point/external/fetch_test.php} | 11 +---------- .../gradingpanel/point/external/store_test.php} | 11 +---------- .../gradingpanel/scale/external/fetch_test.php} | 11 +---------- .../gradingpanel/scale/external/store_test.php} | 11 +---------- ...e_storage_test.php => file_storage_test.php} | 14 +++----------- .../{ => task}/completion_daily_task_test.php | 8 -------- .../manager_test.php} | 14 ++++---------- .../running_test.php} | 15 ++++----------- .../forum_gradeitem_test.php} | 6 ++++-- .../gradeitems_test.php} | 11 +---------- .../canedit_test.php} | 6 +++--- .../ltiopenid/registration_test.php} | 13 ++++--------- 45 files changed, 85 insertions(+), 232 deletions(-) rename admin/tool/brickfield/tests/{ => local/tool}/activityresults_test.php (100%) rename admin/tool/brickfield/tests/{ => local/tool}/checktyperesults_test.php (100%) rename admin/tool/brickfield/tests/{ => local/tool}/errors_test.php (100%) rename admin/tool/brickfield/tests/{ => local/tool}/printable_test.php (100%) rename admin/tool/moodlenet/tests/{ => local}/import_handler_info_test.php (95%) rename admin/tool/moodlenet/tests/{ => local}/import_handler_registry_test.php (97%) rename admin/tool/moodlenet/tests/{ => local}/import_info_test.php (96%) rename admin/tool/moodlenet/tests/{ => local}/import_processor_test.php (98%) rename admin/tool/moodlenet/tests/{ => local}/remote_resource_test.php (96%) rename admin/tool/moodlenet/tests/{ => local}/url_test.php (96%) rename course/format/tests/{ => output/local/state}/state_test.php (99%) rename enrol/meta/tests/{external_add_instances_test.php => external/add_instances_test.php} (98%) rename enrol/meta/tests/{external_delete_instances_test.php => external/delete_instances_test.php} (98%) rename grade/grading/form/guide/tests/{grades_grader_gradingpanel_guide_external_fetch_test.php => grades/grader/gradingpanel/external/fetch_test.php} (97%) rename grade/grading/form/guide/tests/{grades_grader_gradingpanel_guide_external_store_test.php => grades/grader/gradingpanel/external/store_test.php} (96%) rename grade/grading/form/rubric/tests/{grades_grader_gradingpanel_rubric_external_fetch_test.php => grades/grader/gradingpanel/external/fetch_test.php} (97%) rename grade/grading/form/rubric/tests/{grades_grader_gradingpanel_rubric_external_store_test.php => grades/grader/gradingpanel/external/store_test.php} (96%) rename grade/tests/{grades_grader_gradingpanel_point_external_fetch_test.php => grades/grader/gradingpanel/point/external/fetch_test.php} (96%) rename grade/tests/{grades_grader_gradingpanel_point_external_store_test.php => grades/grader/gradingpanel/point/external/store_test.php} (97%) rename grade/tests/{grades_grader_gradingpanel_scale_external_fetch_test.php => grades/grader/gradingpanel/scale/external/fetch_test.php} (97%) rename grade/tests/{grades_grader_gradingpanel_scale_external_store_test.php => grades/grader/gradingpanel/scale/external/store_test.php} (98%) rename h5p/tests/{h5p_file_storage_test.php => file_storage_test.php} (99%) rename lib/tests/{ => task}/completion_daily_task_test.php (96%) rename lib/tests/{task_manager_test.php => task/manager_test.php} (96%) rename lib/tests/{task_running_test.php => task/running_test.php} (94%) rename mod/forum/tests/{grades_forum_gradeitem_test.php => grade/forum_gradeitem_test.php} (97%) rename mod/forum/tests/{grades_gradeitems_test.php => grade/gradeitems_test.php} (91%) rename mod/forum/tests/{h5p_canedit_test.php => h5p/canedit_test.php} (97%) rename mod/lti/tests/{openidregistration_test.php => local/ltiopenid/registration_test.php} (98%) diff --git a/admin/tool/brickfield/tests/activityresults_test.php b/admin/tool/brickfield/tests/local/tool/activityresults_test.php similarity index 100% rename from admin/tool/brickfield/tests/activityresults_test.php rename to admin/tool/brickfield/tests/local/tool/activityresults_test.php diff --git a/admin/tool/brickfield/tests/checktyperesults_test.php b/admin/tool/brickfield/tests/local/tool/checktyperesults_test.php similarity index 100% rename from admin/tool/brickfield/tests/checktyperesults_test.php rename to admin/tool/brickfield/tests/local/tool/checktyperesults_test.php diff --git a/admin/tool/brickfield/tests/errors_test.php b/admin/tool/brickfield/tests/local/tool/errors_test.php similarity index 100% rename from admin/tool/brickfield/tests/errors_test.php rename to admin/tool/brickfield/tests/local/tool/errors_test.php diff --git a/admin/tool/brickfield/tests/printable_test.php b/admin/tool/brickfield/tests/local/tool/printable_test.php similarity index 100% rename from admin/tool/brickfield/tests/printable_test.php rename to admin/tool/brickfield/tests/local/tool/printable_test.php diff --git a/admin/tool/httpsreplace/tests/httpsreplace_test.php b/admin/tool/httpsreplace/tests/httpsreplace_test.php index afc5cac9d0ede..dcf3c221d2df5 100644 --- a/admin/tool/httpsreplace/tests/httpsreplace_test.php +++ b/admin/tool/httpsreplace/tests/httpsreplace_test.php @@ -22,8 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace tool_httpsreplace\tests; - +namespace tool_httpsreplace; defined('MOODLE_INTERNAL') || die(); diff --git a/admin/tool/moodlenet/tests/import_handler_info_test.php b/admin/tool/moodlenet/tests/local/import_handler_info_test.php similarity index 95% rename from admin/tool/moodlenet/tests/import_handler_info_test.php rename to admin/tool/moodlenet/tests/local/import_handler_info_test.php index 59f2db80e3707..8535be29a33bd 100644 --- a/admin/tool/moodlenet/tests/import_handler_info_test.php +++ b/admin/tool/moodlenet/tests/local/import_handler_info_test.php @@ -14,24 +14,19 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for the import_handler_info class. - * - * @package tool_moodlenet - * @category test - * @copyright 2020 Jake Dallimore - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -namespace tool_moodlenet\local\tests; +namespace tool_moodlenet\local; use tool_moodlenet\local\import_handler_info; use tool_moodlenet\local\import_strategy; use tool_moodlenet\local\import_strategy_file; -defined('MOODLE_INTERNAL') || die(); - /** * Class tool_moodlenet_import_handler_info_testcase, providing test cases for the import_handler_info class. + * + * @package tool_moodlenet + * @category test + * @copyright 2020 Jake Dallimore + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class import_handler_info_test extends \advanced_testcase { diff --git a/admin/tool/moodlenet/tests/import_handler_registry_test.php b/admin/tool/moodlenet/tests/local/import_handler_registry_test.php similarity index 97% rename from admin/tool/moodlenet/tests/import_handler_registry_test.php rename to admin/tool/moodlenet/tests/local/import_handler_registry_test.php index 957f9db40aa80..0c679515f036b 100644 --- a/admin/tool/moodlenet/tests/import_handler_registry_test.php +++ b/admin/tool/moodlenet/tests/local/import_handler_registry_test.php @@ -14,15 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for the import_handler_registry class. - * - * @package tool_moodlenet - * @category test - * @copyright 2020 Jake Dallimore - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -namespace tool_moodlenet\local\tests; +namespace tool_moodlenet\local; use tool_moodlenet\local\import_handler_registry; use tool_moodlenet\local\import_handler_info; @@ -31,10 +23,13 @@ use tool_moodlenet\local\remote_resource; use tool_moodlenet\local\url; -defined('MOODLE_INTERNAL') || die(); - /** * Class tool_moodlenet_import_handler_registry_testcase, providing test cases for the import_handler_registry class. + * + * @package tool_moodlenet + * @category test + * @copyright 2020 Jake Dallimore + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class import_handler_registry_test extends \advanced_testcase { diff --git a/admin/tool/moodlenet/tests/import_info_test.php b/admin/tool/moodlenet/tests/local/import_info_test.php similarity index 96% rename from admin/tool/moodlenet/tests/import_info_test.php rename to admin/tool/moodlenet/tests/local/import_info_test.php index 40731d9bdc0a3..754fbbce8f1bd 100644 --- a/admin/tool/moodlenet/tests/import_info_test.php +++ b/admin/tool/moodlenet/tests/local/import_info_test.php @@ -14,24 +14,19 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for the import_info class. - * - * @package tool_moodlenet - * @category test - * @copyright 2020 Jake Dallimore - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -namespace tool_moodlenet\local\tests; +namespace tool_moodlenet\local; use tool_moodlenet\local\import_info; use tool_moodlenet\local\remote_resource; use tool_moodlenet\local\url; -defined('MOODLE_INTERNAL') || die(); - /** * Class tool_moodlenet_import_info_testcase, providing test cases for the import_info class. + * + * @package tool_moodlenet + * @category test + * @copyright 2020 Jake Dallimore + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class import_info_test extends \advanced_testcase { diff --git a/admin/tool/moodlenet/tests/import_processor_test.php b/admin/tool/moodlenet/tests/local/import_processor_test.php similarity index 98% rename from admin/tool/moodlenet/tests/import_processor_test.php rename to admin/tool/moodlenet/tests/local/import_processor_test.php index 3721a68ca9ca5..26f73f668b162 100644 --- a/admin/tool/moodlenet/tests/import_processor_test.php +++ b/admin/tool/moodlenet/tests/local/import_processor_test.php @@ -14,15 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for the import_processor class. - * - * @package tool_moodlenet - * @category test - * @copyright 2020 Jake Dallimore - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -namespace tool_moodlenet\local\tests; +namespace tool_moodlenet\local; use tool_moodlenet\local\import_handler_registry; use tool_moodlenet\local\import_processor; @@ -31,10 +23,13 @@ use tool_moodlenet\local\remote_resource; use tool_moodlenet\local\url; -defined('MOODLE_INTERNAL') || die(); - /** * Class tool_moodlenet_import_processor_testcase, providing test cases for the import_processor class. + * + * @package tool_moodlenet + * @category test + * @copyright 2020 Jake Dallimore + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class import_processor_test extends \advanced_testcase { diff --git a/admin/tool/moodlenet/tests/remote_resource_test.php b/admin/tool/moodlenet/tests/local/remote_resource_test.php similarity index 96% rename from admin/tool/moodlenet/tests/remote_resource_test.php rename to admin/tool/moodlenet/tests/local/remote_resource_test.php index cafab446f3f92..500f95af4b2eb 100644 --- a/admin/tool/moodlenet/tests/remote_resource_test.php +++ b/admin/tool/moodlenet/tests/local/remote_resource_test.php @@ -14,23 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for the remote_resource class. - * - * @package tool_moodlenet - * @category test - * @copyright 2020 Jake Dallimore - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -namespace tool_moodlenet\local\tests; +namespace tool_moodlenet\local; use tool_moodlenet\local\remote_resource; use tool_moodlenet\local\url; -defined('MOODLE_INTERNAL') || die(); - /** * Class tool_moodlenet_remote_resource_testcase, providing test cases for the remote_resource class. + * + * @package tool_moodlenet + * @category test + * @copyright 2020 Jake Dallimore + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class remote_resource_test extends \advanced_testcase { diff --git a/admin/tool/moodlenet/tests/url_test.php b/admin/tool/moodlenet/tests/local/url_test.php similarity index 96% rename from admin/tool/moodlenet/tests/url_test.php rename to admin/tool/moodlenet/tests/local/url_test.php index 545e3ff5121d6..f48c0701140b8 100644 --- a/admin/tool/moodlenet/tests/url_test.php +++ b/admin/tool/moodlenet/tests/local/url_test.php @@ -14,23 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +namespace tool_moodlenet\local; + +use tool_moodlenet\local\url; + /** - * Unit tests for the url class. + * Class tool_moodlenet_url_testcase, providing test cases for the url class. * * @package tool_moodlenet * @category test * @copyright 2020 Jake Dallimore * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace tool_moodlenet\local\tests; - -use tool_moodlenet\local\url; - -defined('MOODLE_INTERNAL') || die(); - -/** - * Class tool_moodlenet_url_testcase, providing test cases for the url class. - */ class url_test extends \advanced_testcase { /** diff --git a/blocks/accessreview/tests/accessibility_review_test.php b/blocks/accessreview/tests/accessibility_review_test.php index db8a5b58d449a..00f74ad458cac 100644 --- a/blocks/accessreview/tests/accessibility_review_test.php +++ b/blocks/accessreview/tests/accessibility_review_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace block_accessreview\tests; +namespace block_accessreview; use ReflectionClass; use advanced_testcase; diff --git a/blocks/badges/tests/badges_test.php b/blocks/badges/tests/badges_test.php index d8a6c6b575f06..2bd60e552f3fe 100644 --- a/blocks/badges/tests/badges_test.php +++ b/blocks/badges/tests/badges_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace block_badges\tests; +namespace block_badges; use advanced_testcase; use block_badges; diff --git a/blocks/blog_menu/tests/blog_menu_test.php b/blocks/blog_menu/tests/blog_menu_test.php index 2a5e66f2d050e..be1d28e840e31 100644 --- a/blocks/blog_menu/tests/blog_menu_test.php +++ b/blocks/blog_menu/tests/blog_menu_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace block_blog_menu\tests; +namespace block_blog_menu; use advanced_testcase; use block_blog_menu; diff --git a/blocks/blog_recent/tests/blog_recent_test.php b/blocks/blog_recent/tests/blog_recent_test.php index 88e1ec88cc66a..6b69e6156bfb1 100644 --- a/blocks/blog_recent/tests/blog_recent_test.php +++ b/blocks/blog_recent/tests/blog_recent_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace block_blog_recent\tests; +namespace block_blog_recent; use advanced_testcase; use block_blog_recent; diff --git a/blocks/blog_tags/tests/blog_tags_test.php b/blocks/blog_tags/tests/blog_tags_test.php index 27f0fbd19caf5..6244e7def8093 100644 --- a/blocks/blog_tags/tests/blog_tags_test.php +++ b/blocks/blog_tags/tests/blog_tags_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace block_blog_tags\tests; +namespace block_blog_tags; use advanced_testcase; use block_blog_tags; diff --git a/blocks/comments/tests/comments_test.php b/blocks/comments/tests/comments_test.php index 2de1aaa36a7ca..e19eb26e23df6 100644 --- a/blocks/comments/tests/comments_test.php +++ b/blocks/comments/tests/comments_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace block_comments\tests; +namespace block_comments; use advanced_testcase; use block_comments; diff --git a/blocks/completionstatus/tests/completionstatus_test.php b/blocks/completionstatus/tests/completionstatus_test.php index a05451fa11613..deb92674091eb 100644 --- a/blocks/completionstatus/tests/completionstatus_test.php +++ b/blocks/completionstatus/tests/completionstatus_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace block_completionstatus\tests; +namespace block_completionstatus; use advanced_testcase; use block_completionstatus; diff --git a/blocks/globalsearch/tests/globalsearch_test.php b/blocks/globalsearch/tests/globalsearch_test.php index ade091083a840..29e438824aaa6 100644 --- a/blocks/globalsearch/tests/globalsearch_test.php +++ b/blocks/globalsearch/tests/globalsearch_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace block_globalsearch\tests; +namespace block_globalsearch; use advanced_testcase; use block_globalsearch; diff --git a/blocks/glossary_random/tests/glossary_random_test.php b/blocks/glossary_random/tests/glossary_random_test.php index 2b9e2b2d0d352..08b07821ceb51 100644 --- a/blocks/glossary_random/tests/glossary_random_test.php +++ b/blocks/glossary_random/tests/glossary_random_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace block_glossary_random\tests; +namespace block_glossary_random; use advanced_testcase; use block_glossary_random; diff --git a/blocks/lp/tests/lp_test.php b/blocks/lp/tests/lp_test.php index 8b32ad7e26866..d93d91c052143 100644 --- a/blocks/lp/tests/lp_test.php +++ b/blocks/lp/tests/lp_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace block_lp\tests; +namespace block_lp; use advanced_testcase; use block_lp; diff --git a/blocks/mnet_hosts/tests/mnet_hosts_test.php b/blocks/mnet_hosts/tests/mnet_hosts_test.php index e831f321cf020..a15a2ec8d35a4 100644 --- a/blocks/mnet_hosts/tests/mnet_hosts_test.php +++ b/blocks/mnet_hosts/tests/mnet_hosts_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace block_mnet_hosts\tests; +namespace block_mnet_hosts; use advanced_testcase; use block_mnet_hosts; diff --git a/blocks/tags/tests/tags_test.php b/blocks/tags/tests/tags_test.php index 8fcffd4d71fcf..4c69a5870c2f8 100644 --- a/blocks/tags/tests/tags_test.php +++ b/blocks/tags/tests/tags_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace block_tags\tests; +namespace block_tags; use advanced_testcase; use block_tags; diff --git a/course/format/tests/state_test.php b/course/format/tests/output/local/state/state_test.php similarity index 99% rename from course/format/tests/state_test.php rename to course/format/tests/output/local/state/state_test.php index 1a66113e43809..f39de5f30e66d 100644 --- a/course/format/tests/state_test.php +++ b/course/format/tests/output/local/state/state_test.php @@ -16,8 +16,6 @@ namespace core_courseformat\output\local\state; -defined('MOODLE_INTERNAL') || die(); - /** * Tests for state classes (course, section, cm). * @@ -37,6 +35,7 @@ public static function setupBeforeClass(): void { require_once($CFG->dirroot . '/course/lib.php'); require_once($CFG->dirroot . '/course/format/tests/fixtures/format_theunittest.php'); require_once($CFG->dirroot . '/course/format/tests/fixtures/format_theunittest_output_course_format_state.php'); + require_once($CFG->dirroot . '/lib/externallib.php'); } /** diff --git a/course/tests/course_delete_modules_test.php b/course/tests/course_delete_modules_test.php index 6b39a8de621eb..72098f0b16af5 100644 --- a/course/tests/course_delete_modules_test.php +++ b/course/tests/course_delete_modules_test.php @@ -22,9 +22,7 @@ * @copyright 2021 Tomo Tsuyuki * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace tests\core_course; - -defined('MOODLE_INTERNAL') || die(); +namespace core_course; /** * Tests for the \core_course\task\course_delete_modules class. diff --git a/course/tests/notifications_test.php b/course/tests/notifications_test.php index 951d8b625e0f3..8dcb61f12bc0e 100644 --- a/course/tests/notifications_test.php +++ b/course/tests/notifications_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace tests\core_course; +namespace core_course; /** * Contains tests for course related notifications. diff --git a/enrol/meta/tests/external_add_instances_test.php b/enrol/meta/tests/external/add_instances_test.php similarity index 98% rename from enrol/meta/tests/external_add_instances_test.php rename to enrol/meta/tests/external/add_instances_test.php index ea1baa905e1af..16ce1643014e7 100644 --- a/enrol/meta/tests/external_add_instances_test.php +++ b/enrol/meta/tests/external/add_instances_test.php @@ -30,7 +30,7 @@ * @copyright 2021 WKS KV Bildung * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class external_add_instances_test extends \externallib_advanced_testcase { +class add_instances_test extends \externallib_advanced_testcase { /** * Test setup diff --git a/enrol/meta/tests/external_delete_instances_test.php b/enrol/meta/tests/external/delete_instances_test.php similarity index 98% rename from enrol/meta/tests/external_delete_instances_test.php rename to enrol/meta/tests/external/delete_instances_test.php index 58f6c47ad952d..53c79dd74f60e 100644 --- a/enrol/meta/tests/external_delete_instances_test.php +++ b/enrol/meta/tests/external/delete_instances_test.php @@ -30,7 +30,7 @@ * @copyright 2021 WKS KV Bildung * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class external_delete_instances_test extends \externallib_advanced_testcase { +class delete_instances_test extends \externallib_advanced_testcase { /** * Test setup diff --git a/grade/grading/form/guide/tests/grades_grader_gradingpanel_guide_external_fetch_test.php b/grade/grading/form/guide/tests/grades/grader/gradingpanel/external/fetch_test.php similarity index 97% rename from grade/grading/form/guide/tests/grades_grader_gradingpanel_guide_external_fetch_test.php rename to grade/grading/form/guide/tests/grades/grader/gradingpanel/external/fetch_test.php index 46f62b455dba6..cb86d137668a7 100644 --- a/grade/grading/form/guide/tests/grades_grader_gradingpanel_guide_external_fetch_test.php +++ b/grade/grading/form/guide/tests/grades/grader/gradingpanel/external/fetch_test.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for core_grades\component_gradeitems; - * - * @package gradingform_guide - * @category test - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - */ - declare(strict_types = 1); namespace gradingform_guide\grades\grader\gradingpanel\external; @@ -42,7 +33,7 @@ * @copyright 2019 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class grades_grader_gradingpanel_guide_external_fetch_test extends advanced_testcase { +class fetch_test extends advanced_testcase { public static function setupBeforeClass(): void { global $CFG; diff --git a/grade/grading/form/guide/tests/grades_grader_gradingpanel_guide_external_store_test.php b/grade/grading/form/guide/tests/grades/grader/gradingpanel/external/store_test.php similarity index 96% rename from grade/grading/form/guide/tests/grades_grader_gradingpanel_guide_external_store_test.php rename to grade/grading/form/guide/tests/grades/grader/gradingpanel/external/store_test.php index f2bf5f33e269a..5d64994160833 100644 --- a/grade/grading/form/guide/tests/grades_grader_gradingpanel_guide_external_store_test.php +++ b/grade/grading/form/guide/tests/grades/grader/gradingpanel/external/store_test.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for core_grades\component_gradeitems; - * - * @package gradingform_guide - * @category test - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - */ - declare(strict_types = 1); namespace gradingform_guide\grades\grader\gradingpanel\external; @@ -42,7 +33,7 @@ * @copyright 2019 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class grades_grader_gradingpanel_guide_external_store_test extends advanced_testcase { +class store_test extends advanced_testcase { public static function setupBeforeClass(): void { global $CFG; diff --git a/grade/grading/form/rubric/tests/grades_grader_gradingpanel_rubric_external_fetch_test.php b/grade/grading/form/rubric/tests/grades/grader/gradingpanel/external/fetch_test.php similarity index 97% rename from grade/grading/form/rubric/tests/grades_grader_gradingpanel_rubric_external_fetch_test.php rename to grade/grading/form/rubric/tests/grades/grader/gradingpanel/external/fetch_test.php index 42839ecb67b7d..68402617c405f 100644 --- a/grade/grading/form/rubric/tests/grades_grader_gradingpanel_rubric_external_fetch_test.php +++ b/grade/grading/form/rubric/tests/grades/grader/gradingpanel/external/fetch_test.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for core_grades\component_gradeitems; - * - * @package gradingform_rubric - * @category test - * @copyright 2019 Mathew May - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - */ - declare(strict_types = 1); namespace gradingform_rubric\grades\grader\gradingpanel\external; @@ -43,7 +34,7 @@ * @copyright 2019 Mathew May * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class grades_grader_gradingpanel_rubric_external_fetch_test extends advanced_testcase { +class fetch_test extends advanced_testcase { public static function setupBeforeClass(): void { global $CFG; diff --git a/grade/grading/form/rubric/tests/grades_grader_gradingpanel_rubric_external_store_test.php b/grade/grading/form/rubric/tests/grades/grader/gradingpanel/external/store_test.php similarity index 96% rename from grade/grading/form/rubric/tests/grades_grader_gradingpanel_rubric_external_store_test.php rename to grade/grading/form/rubric/tests/grades/grader/gradingpanel/external/store_test.php index ca6bfb209e797..f911134b18ed2 100644 --- a/grade/grading/form/rubric/tests/grades_grader_gradingpanel_rubric_external_store_test.php +++ b/grade/grading/form/rubric/tests/grades/grader/gradingpanel/external/store_test.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for core_grades\component_gradeitems; - * - * @package gradingform_rubric - * @category test - * @copyright 2019 Mathew May - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - */ - declare(strict_types = 1); namespace gradingform_rubric\grades\grader\gradingpanel\external; @@ -42,7 +33,7 @@ * @copyright 2019 Mathew May * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class grades_grader_gradingpanel_rubric_external_store_test extends advanced_testcase { +class store_test extends advanced_testcase { public static function setupBeforeClass(): void { global $CFG; diff --git a/grade/tests/component_gradeitems_test.php b/grade/tests/component_gradeitems_test.php index a84e5774f5236..a37c22d01c2ee 100644 --- a/grade/tests/component_gradeitems_test.php +++ b/grade/tests/component_gradeitems_test.php @@ -25,7 +25,7 @@ declare(strict_types = 1); -namespace tests\core_grades { +namespace core_grades { use advanced_testcase; use core_grades\component_gradeitems; diff --git a/grade/tests/grades_grader_gradingpanel_point_external_fetch_test.php b/grade/tests/grades/grader/gradingpanel/point/external/fetch_test.php similarity index 96% rename from grade/tests/grades_grader_gradingpanel_point_external_fetch_test.php rename to grade/tests/grades/grader/gradingpanel/point/external/fetch_test.php index 14104cb5e01ea..282d04b399ab6 100644 --- a/grade/tests/grades_grader_gradingpanel_point_external_fetch_test.php +++ b/grade/tests/grades/grader/gradingpanel/point/external/fetch_test.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for core_grades\component_gradeitems; - * - * @package core_grades - * @category test - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - */ - declare(strict_types = 1); namespace core_grades\grades\grader\gradingpanel\point\external; @@ -42,7 +33,7 @@ * @copyright 2019 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class grades_grader_gradingpanel_point_external_fetch_test extends advanced_testcase { +class fetch_test extends advanced_testcase { public static function setupBeforeClass(): void { global $CFG; diff --git a/grade/tests/grades_grader_gradingpanel_point_external_store_test.php b/grade/tests/grades/grader/gradingpanel/point/external/store_test.php similarity index 97% rename from grade/tests/grades_grader_gradingpanel_point_external_store_test.php rename to grade/tests/grades/grader/gradingpanel/point/external/store_test.php index bc6a31e7b07f0..183d2ea8c96f6 100644 --- a/grade/tests/grades_grader_gradingpanel_point_external_store_test.php +++ b/grade/tests/grades/grader/gradingpanel/point/external/store_test.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for core_grades\component_gradeitems; - * - * @package core_grades - * @category test - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - */ - declare(strict_types = 1); namespace core_grades\grades\grader\gradingpanel\point\external; @@ -44,7 +35,7 @@ * @copyright 2019 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class grades_grader_gradingpanel_point_external_store_test extends advanced_testcase { +class store_test extends advanced_testcase { public static function setupBeforeClass(): void { global $CFG; diff --git a/grade/tests/grades_grader_gradingpanel_scale_external_fetch_test.php b/grade/tests/grades/grader/gradingpanel/scale/external/fetch_test.php similarity index 97% rename from grade/tests/grades_grader_gradingpanel_scale_external_fetch_test.php rename to grade/tests/grades/grader/gradingpanel/scale/external/fetch_test.php index ffb99a299b8b3..a4bb51a82da2e 100644 --- a/grade/tests/grades_grader_gradingpanel_scale_external_fetch_test.php +++ b/grade/tests/grades/grader/gradingpanel/scale/external/fetch_test.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for core_grades\component_gradeitems; - * - * @package core_grades - * @category test - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - */ - declare(strict_types = 1); namespace core_grades\grades\grader\gradingpanel\scale\external; @@ -42,7 +33,7 @@ * @copyright 2019 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class grades_grader_gradingpanel_scale_external_fetch_test extends advanced_testcase { +class fetch_test extends advanced_testcase { public static function setupBeforeClass(): void { global $CFG; diff --git a/grade/tests/grades_grader_gradingpanel_scale_external_store_test.php b/grade/tests/grades/grader/gradingpanel/scale/external/store_test.php similarity index 98% rename from grade/tests/grades_grader_gradingpanel_scale_external_store_test.php rename to grade/tests/grades/grader/gradingpanel/scale/external/store_test.php index 066ab6b5b6065..96a0d8fc55855 100644 --- a/grade/tests/grades_grader_gradingpanel_scale_external_store_test.php +++ b/grade/tests/grades/grader/gradingpanel/scale/external/store_test.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for core_grades\component_gradeitems; - * - * @package core_grades - * @category test - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - */ - declare(strict_types = 1); namespace core_grades\grades\grader\gradingpanel\scale\external; @@ -44,7 +35,7 @@ * @copyright 2019 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class grades_grader_gradingpanel_scale_external_store_test extends advanced_testcase { +class store_test extends advanced_testcase { public static function setupBeforeClass(): void { global $CFG; diff --git a/h5p/tests/h5p_file_storage_test.php b/h5p/tests/file_storage_test.php similarity index 99% rename from h5p/tests/h5p_file_storage_test.php rename to h5p/tests/file_storage_test.php index 562fd4c941d2b..e81e804facfe7 100644 --- a/h5p/tests/h5p_file_storage_test.php +++ b/h5p/tests/file_storage_test.php @@ -14,16 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Testing the H5P H5PFileStorage interface implementation. - * - * @package core_h5p - * @category test - * @copyright 2019 Victor Deniz - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -namespace core_h5p\local\tests; +namespace core_h5p; use core_h5p\file_storage; use core_h5p\local\library\autoloader; @@ -38,11 +29,12 @@ * Test class covering the H5PFileStorage interface implementation. * * @package core_h5p + * @category test * @copyright 2019 Victor Deniz * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @runTestsInSeparateProcesses */ -class h5p_file_storage_test extends \advanced_testcase { +class file_storage_test extends \advanced_testcase { /** @var \core_h5p\file_storage H5P file storage instance */ protected $h5p_file_storage; diff --git a/lib/tests/completion_daily_task_test.php b/lib/tests/task/completion_daily_task_test.php similarity index 96% rename from lib/tests/completion_daily_task_test.php rename to lib/tests/task/completion_daily_task_test.php index baba7825ef777..fde8a40eaa973 100644 --- a/lib/tests/completion_daily_task_test.php +++ b/lib/tests/task/completion_daily_task_test.php @@ -14,14 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Contains the class containing unit tests for the daily completion cron task. - * - * @package core - * @copyright 2020 Jun Pataleta - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace core\task; use advanced_testcase; diff --git a/lib/tests/task_manager_test.php b/lib/tests/task/manager_test.php similarity index 96% rename from lib/tests/task_manager_test.php rename to lib/tests/task/manager_test.php index 59eb8f38393eb..f84e77ce897b8 100644 --- a/lib/tests/task_manager_test.php +++ b/lib/tests/task/manager_test.php @@ -14,26 +14,20 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * This file contains the unit tests for the task manager. - * - * @package core - * @copyright 2019 Brendan Heywood - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace core\task; defined('MOODLE_INTERNAL') || die(); -require_once(__DIR__ . '/fixtures/task_fixtures.php'); +require_once(__DIR__ . '/../fixtures/task_fixtures.php'); /** * This file contains the unit tests for the task manager. * + * @package core + * @category test * @copyright 2019 Brendan Heywood * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class task_manager_test extends \advanced_testcase { +class manager_test extends \advanced_testcase { /** * Data provider for test_get_candidate_adhoc_tasks. diff --git a/lib/tests/task_running_test.php b/lib/tests/task/running_test.php similarity index 94% rename from lib/tests/task_running_test.php rename to lib/tests/task/running_test.php index 378101caf82d8..0cfb91e0a49cc 100644 --- a/lib/tests/task_running_test.php +++ b/lib/tests/task/running_test.php @@ -14,28 +14,21 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * This file contains unit tests for the 'task running' data. - * - * @package core - * @copyright 2019 The Open University - * @copyright 2020 Mikhail Golenkov - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace core\task; defined('MOODLE_INTERNAL') || die(); -require_once(__DIR__ . '/fixtures/task_fixtures.php'); +require_once(__DIR__ . '/../fixtures/task_fixtures.php'); /** * This file contains unit tests for the 'task running' data. * + * @package core + * @category test * @copyright 2019 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class task_running_test extends \advanced_testcase { +class running_test extends \advanced_testcase { /** * Test for ad-hoc tasks. diff --git a/mod/forum/tests/grades_forum_gradeitem_test.php b/mod/forum/tests/grade/forum_gradeitem_test.php similarity index 97% rename from mod/forum/tests/grades_forum_gradeitem_test.php rename to mod/forum/tests/grade/forum_gradeitem_test.php index a7da3930c25cf..be983a7313522 100644 --- a/mod/forum/tests/grades_forum_gradeitem_test.php +++ b/mod/forum/tests/grade/forum_gradeitem_test.php @@ -30,7 +30,9 @@ use gradingform_controller; use mod_forum\grades\forum_gradeitem; -require_once(__DIR__ . '/generator_trait.php'); +defined('MOODLE_INTERNAL') || die(); + +require_once(__DIR__ . '/../generator_trait.php'); /** * Tests for the the Forum gradeitem. @@ -39,7 +41,7 @@ * @copyright Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class grades_forum_gradeitem_test extends \advanced_testcase { +class forum_gradeitem_test extends \advanced_testcase { use \mod_forum_tests_generator_trait; /** diff --git a/mod/forum/tests/grades_gradeitems_test.php b/mod/forum/tests/grade/gradeitems_test.php similarity index 91% rename from mod/forum/tests/grades_gradeitems_test.php rename to mod/forum/tests/grade/gradeitems_test.php index d3e2321bef05e..404791ac8a4f8 100644 --- a/mod/forum/tests/grades_gradeitems_test.php +++ b/mod/forum/tests/grade/gradeitems_test.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Unit tests for mod_forum\grades\gradeitems. - * - * @package mod_forum - * @category test - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - */ - declare(strict_types = 1); namespace mod_forum\grade; @@ -39,7 +30,7 @@ * @copyright 2019 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class grades_gradeitems_test extends advanced_testcase { +class gradeitems_test extends advanced_testcase { /** * Ensure that the mappings are present and correct. diff --git a/mod/forum/tests/h5p_canedit_test.php b/mod/forum/tests/h5p/canedit_test.php similarity index 97% rename from mod/forum/tests/h5p_canedit_test.php rename to mod/forum/tests/h5p/canedit_test.php index 64062a2801861..17139438844ee 100644 --- a/mod/forum/tests/h5p_canedit_test.php +++ b/mod/forum/tests/h5p/canedit_test.php @@ -28,7 +28,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @coversDefaultClass \mod_forum\h5p\canedit */ -class h5p_canedit_test extends \advanced_testcase { +class canedit_test extends \advanced_testcase { /** * Test the behaviour of can_edit_content(). @@ -86,7 +86,7 @@ public function test_can_edit_content(string $currentuser, string $fileauthor, s // Create the file. $filename = 'greeting-card-887.h5p'; - $path = __DIR__ . '/../../../h5p/tests/fixtures/' . $filename; + $path = __DIR__ . '/../../../../h5p/tests/fixtures/' . $filename; if ($filecomponent === 'contentbank') { $generator = $this->getDataGenerator()->get_plugin_generator('core_contentbank'); $contents = $generator->generate_contentbank_data( @@ -114,7 +114,7 @@ public function test_can_edit_content(string $currentuser, string $fileauthor, s } // Check if the currentuser can edit the file. - $result = \mod_forum\h5p\canedit::can_edit_content($file); + $result = canedit::can_edit_content($file); $this->assertEquals($expected, $result); } diff --git a/mod/lti/tests/openidregistration_test.php b/mod/lti/tests/local/ltiopenid/registration_test.php similarity index 98% rename from mod/lti/tests/openidregistration_test.php rename to mod/lti/tests/local/ltiopenid/registration_test.php index dc266bc68dd86..d700a6570f637 100644 --- a/mod/lti/tests/openidregistration_test.php +++ b/mod/lti/tests/local/ltiopenid/registration_test.php @@ -32,22 +32,17 @@ // of the Universitat Politecnica de Catalunya http://www.upc.edu // Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu. +namespace mod_lti\local\ltiopenid; + /** - * This file contains unit tests for lti/openidregistrationlib.php + * OpenId LTI Registration library tests * * @package mod_lti * @copyright 2020 Claude Vervoort, Cengage * @author Claude Vervoort * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -namespace mod_lti\local\ltiopenid; -use mod_lti\local\ltiopenid\registration_exception; -use mod_lti\local\ltiopenid\registration_helper; - -/** - * OpenId LTI Registration library tests - */ -class openidregistration_test extends \advanced_testcase { +class registration_test extends \advanced_testcase { /** * @var string A has-it-all client registration.