diff --git a/admin/tool/admin_presets/tests/generator_test.php b/admin/tool/admin_presets/tests/generator_test.php index 870cf14deea..110ceb294b6 100644 --- a/admin/tool/admin_presets/tests/generator_test.php +++ b/admin/tool/admin_presets/tests/generator_test.php @@ -23,7 +23,7 @@ namespace tool_admin_presets; * @category test * @copyright 2021 Sara Arjona (sara@moodle.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @coversDefaultClass tool_admin_presets_generator + * @coversDefaultClass \tool_admin_presets_generator */ class generator_test extends \advanced_testcase { diff --git a/admin/tool/admin_presets/tests/helper_test.php b/admin/tool/admin_presets/tests/helper_test.php index 18a2ba58390..e1ab519f5cb 100644 --- a/admin/tool/admin_presets/tests/helper_test.php +++ b/admin/tool/admin_presets/tests/helper_test.php @@ -23,7 +23,7 @@ namespace tool_admin_presets; * @category test * @copyright 2021 Sara Arjona (sara@moodle.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @coversDefaultClass helper + * @coversDefaultClass \tool_admin_presets\helper */ class helper_test extends \advanced_testcase { diff --git a/admin/tool/dataprivacy/tests/coverage.php b/admin/tool/dataprivacy/tests/coverage.php deleted file mode 100644 index 8cf8d5d1d09..00000000000 --- a/admin/tool/dataprivacy/tests/coverage.php +++ /dev/null @@ -1,49 +0,0 @@ -. - -defined('MOODLE_INTERNAL') || die(); - -/** - * Coverage information for the tool_dataprivacy plugin. - * - * @package core - * @category phpunit - * @copyright 2018 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * Coverage information for the tool_dataprivacy plugin. - * - * @copyright 2018 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -return new class extends phpunit_coverage_info { - /** @var array The list of folders relative to the plugin root to include in coverage generation. */ - protected $includelistfolders = [ - 'classes', - ]; - - /** @var array The list of files relative to the plugin root to include in coverage generation. */ - protected $includelistfiles = []; - - /** @var array The list of folders relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfolders = [ - ]; - - /** @var array The list of files relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfiles = []; -}; diff --git a/backup/util/dbops/tests/restore_dbops_test.php b/backup/util/dbops/tests/restore_dbops_test.php index 59c127be41c..78060ae1ea7 100644 --- a/backup/util/dbops/tests/restore_dbops_test.php +++ b/backup/util/dbops/tests/restore_dbops_test.php @@ -301,7 +301,7 @@ class restore_dbops_testcase extends advanced_testcase { * Test restore precheck_user method * * @dataProvider precheck_user_provider - * @covers restore_dbops::precheck_user() + * @covers \restore_dbops::precheck_user() * * @param array $dbuser * @param array $backupuser diff --git a/badges/tests/badgeslib_test.php b/badges/tests/badgeslib_test.php index 2be62c01178..8becec48113 100644 --- a/badges/tests/badgeslib_test.php +++ b/badges/tests/badgeslib_test.php @@ -626,7 +626,7 @@ class badgeslib_test extends advanced_testcase { /** * Test badges observer when cohort_member_added event is fired and user required to belong to any cohort. * - * @covers award_criteria_cohort + * @covers \award_criteria_cohort */ public function test_badges_observer_any_cohort_criteria_review() { global $CFG; @@ -669,7 +669,7 @@ class badgeslib_test extends advanced_testcase { /** * Test badges observer when cohort_member_added event is fired and user required to belong to multiple (all) cohorts. * - * @covers award_criteria_cohort + * @covers \award_criteria_cohort */ public function test_badges_observer_all_cohort_criteria_review() { global $CFG; diff --git a/grade/tests/coverage.php b/blocks/tests/coverage.php similarity index 59% rename from grade/tests/coverage.php rename to blocks/tests/coverage.php index e94090ee9f5..8089444dfe5 100644 --- a/grade/tests/coverage.php +++ b/blocks/tests/coverage.php @@ -15,26 +15,14 @@ // along with Moodle. If not, see . /** - * Coverage information for the grades component. + * Coverage information for the core_block subsystem. * - * @package core_grades - * @category test - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -/** - * Coverage information for the core_grades subsystem. - * - * @package core_grades - * @copyright 2019 Andrew Nicols + * @copyright 2021 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ return new class extends phpunit_coverage_info { - // Array The list of folders relative to the plugin root to include in coverage generation. - protected $includelistfolders = [ - 'classes', + /** @var array The list of files relative to the plugin root to include in coverage generation. */ + protected $includelistfiles = [ + 'moodleblock.class.php', ]; }; diff --git a/contentbank/tests/external/rename_content_test.php b/contentbank/tests/external/rename_content_test.php index 56a0cef380b..6f7f6ff56a6 100644 --- a/contentbank/tests/external/rename_content_test.php +++ b/contentbank/tests/external/rename_content_test.php @@ -41,7 +41,7 @@ use external_api; * @package core_contentbank * @copyright 2020 Sara Arjona * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @coversDefaultClass \core_contentbank\external + * @coversDefaultClass \core_contentbank\external\rename_content */ class rename_content_test extends \externallib_advanced_testcase { diff --git a/course/format/tests/state_test.php b/course/format/tests/state_test.php index cf86709554e..1a66113e438 100644 --- a/course/format/tests/state_test.php +++ b/course/format/tests/state_test.php @@ -43,7 +43,7 @@ class state_test extends \advanced_testcase { * Test the behaviour of state::export_for_template(). * * @dataProvider state_provider - * @coversDefaultClass core_courseformat\output\local\state + * @coversDefaultClass \core_courseformat\output\local\state * * @param string $format The course format of the course where the method will be executed. */ diff --git a/grade/grading/tests/coverage.php b/course/tests/coverage.php similarity index 58% rename from grade/grading/tests/coverage.php rename to course/tests/coverage.php index ca324a72acf..324a3a630a5 100644 --- a/grade/grading/tests/coverage.php +++ b/course/tests/coverage.php @@ -15,27 +15,17 @@ // along with Moodle. If not, see . /** - * Coverage information for the core_grading subsystem. + * Coverage information for the core_course subsystem. * - * @package core_grading - * @category test - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -/** - * Coverage information for the core_grading subsystem. - * - * @package core_grading - * @copyright 2019 Andrew Nicols + * @copyright 2021 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ return new class extends phpunit_coverage_info { - // Array The list of folders relative to the plugin root to include in coverage generation. - protected $includelistfolders = [ - 'classes', - 'tests/generator', + /** @var array The list of files relative to the plugin root to include in coverage generation. */ + protected $includelistfiles = [ + 'dnduploadlib.php', + 'externallib.php', + 'lib.php', + 'modlib.php', ]; }; diff --git a/enrol/fee/tests/payment/service_provider_test.php b/enrol/fee/tests/payment/service_provider_test.php index 2bfe3c69070..a59af4884e4 100644 --- a/enrol/fee/tests/payment/service_provider_test.php +++ b/enrol/fee/tests/payment/service_provider_test.php @@ -28,7 +28,7 @@ namespace enrol_fee\payment; /** * Unit tests for the enrol_fee's payment subsystem callback implementation. * - * @coversDefaultClass service_provider + * @coversDefaultClass \enrol_fee\payment\service_provider */ class service_provider_test extends \advanced_testcase { diff --git a/grade/grading/form/rubric/tests/coverage.php b/grade/grading/form/rubric/tests/coverage.php deleted file mode 100644 index 5f7ea0bd9e1..00000000000 --- a/grade/grading/form/rubric/tests/coverage.php +++ /dev/null @@ -1,41 +0,0 @@ -. - -/** - * Coverage information for the gradingform_rubric plugin. - * - * @package gradingform_rubric - * @category test - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -/** - * Coverage information for the gradingform_rubric plugin. - * - * @package gradingform_rubric - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -return new class extends phpunit_coverage_info { - // Array The list of folders relative to the plugin root to include in coverage generation. - protected $includelistfolders = [ - 'classes', - 'tests/generator', - ]; -}; diff --git a/h5p/tests/coverage.php b/h5p/tests/coverage.php deleted file mode 100644 index 2f44b956404..00000000000 --- a/h5p/tests/coverage.php +++ /dev/null @@ -1,48 +0,0 @@ -. - -defined('MOODLE_INTERNAL') || die(); - -/** - * Coverage information for the core_h5p subsystem. - * - * @package core_h5p - * @category phpunit - * @copyright 2019 Amaia Anabitarte - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * Coverage information for the core H5P subsystem. - * - * @copyright 2019 Amaia Anabitarte - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -return new class extends phpunit_coverage_info { - /** @var array The list of folders relative to the plugin root to include in coverage generation. */ - protected $includelistfolders = [ - 'classes', - ]; - - /** @var array The list of files relative to the plugin root to include in coverage generation. */ - protected $includelistfiles = []; - - /** @var array The list of folders relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfolders = []; - - /** @var array The list of files relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfiles = []; -}; diff --git a/lib/filestorage/tests/file_storage_test.php b/lib/filestorage/tests/file_storage_test.php index a74aa383103..35e7ed7af0c 100644 --- a/lib/filestorage/tests/file_storage_test.php +++ b/lib/filestorage/tests/file_storage_test.php @@ -35,7 +35,7 @@ require_once($CFG->libdir . '/filestorage/stored_file.php'); * * @copyright 2012 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @coversDefaultClass file_storage + * @coversDefaultClass \file_storage */ class core_files_file_storage_testcase extends advanced_testcase { @@ -287,7 +287,7 @@ class core_files_file_storage_testcase extends advanced_testcase { * Make sure renaming is working * * @copyright 2012 Dongsheng Cai {@link http://dongsheng.org} - * @covers stored_file::rename + * @covers \stored_file::rename */ public function test_file_renaming() { global $CFG; @@ -1842,7 +1842,7 @@ class core_files_file_storage_testcase extends advanced_testcase { /** * Calling stored_file::delete_reference() on a non-reference file throws coding_exception * - * @covers stored_file::delete_reference + * @covers \stored_file::delete_reference */ public function test_delete_reference_on_nonreference() { @@ -1870,7 +1870,7 @@ class core_files_file_storage_testcase extends advanced_testcase { * Calling stored_file::delete_reference() on a reference file does not affect other * symlinks to the same original * - * @covers stored_file::delete_reference + * @covers \stored_file::delete_reference */ public function test_delete_reference_one_symlink_does_not_rule_them_all() { diff --git a/lib/filestorage/tests/file_system_filedir_test.php b/lib/filestorage/tests/file_system_filedir_test.php index 63918c38b81..f65378f460b 100644 --- a/lib/filestorage/tests/file_system_filedir_test.php +++ b/lib/filestorage/tests/file_system_filedir_test.php @@ -36,7 +36,7 @@ require_once($CFG->libdir . '/filestorage/file_system_filedir.php'); * @category files * @copyright 2017 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @coversDefaultClass file_system_filedir + * @coversDefaultClass \file_system_filedir */ class core_files_file_system_filedir_testcase extends advanced_testcase { diff --git a/lib/filestorage/tests/file_system_test.php b/lib/filestorage/tests/file_system_test.php index 47159a78c90..1ab6acc4e65 100644 --- a/lib/filestorage/tests/file_system_test.php +++ b/lib/filestorage/tests/file_system_test.php @@ -35,7 +35,7 @@ require_once($CFG->libdir . '/filestorage/file_system.php'); * @category phpunit * @copyright 2017 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @coversDefaultClass file_system + * @coversDefaultClass \file_system */ class core_files_file_system_testcase extends advanced_testcase { diff --git a/lib/phpunit/classes/coverage_info.php b/lib/phpunit/classes/coverage_info.php index c0d6d470bae..3ad26a91f59 100644 --- a/lib/phpunit/classes/coverage_info.php +++ b/lib/phpunit/classes/coverage_info.php @@ -68,6 +68,19 @@ class phpunit_coverage_info { final public function get_includelists(string $plugindir) : array { $coverages = []; + $includelistfolders = array_merge([ + 'classes', + 'tests/generator', + ], $this->includelistfolders);; + + $includelistfiles = array_merge([ + 'externallib.php', + 'lib.php', + 'locallib.php', + 'renderer.php', + 'rsslib.php', + ], $this->includelistfiles); + if (!empty($plugindir)) { $plugindir .= "/"; @@ -79,21 +92,16 @@ class phpunit_coverage_info { "Please, replace them with \$includelistfolders and " . "\$includelistfiles in {$plugindir}tests/coverage.php\n"; - foreach ($this->whitelistfolders as $folder) { - $coverages[] = html_writer::tag('directory', "{$plugindir}{$folder}", ['suffix' => '.php']); - } - - foreach ($this->whitelistfiles as $file) { - $coverages[] = html_writer::tag('file', "{$plugindir}{$file}"); - } + $includelistfolders = array_merge($includelistfolders, $this->whitelistfolders); + $includelistfiles = array_merge($includelistfiles, $this->whitelistfiles); } } - foreach ($this->includelistfolders as $folder) { + foreach ($includelistfolders as $folder) { $coverages[] = html_writer::tag('directory', "{$plugindir}{$folder}", ['suffix' => '.php']); } - foreach ($this->includelistfiles as $file) { + foreach ($includelistfiles as $file) { $coverages[] = html_writer::tag('file', "{$plugindir}{$file}"); } diff --git a/lib/phpunit/classes/util.php b/lib/phpunit/classes/util.php index 4f8ee14e978..da44065f360 100644 --- a/lib/phpunit/classes/util.php +++ b/lib/phpunit/classes/util.php @@ -973,7 +973,7 @@ class phpunit_util extends testing_util { * @param string $fulldir The directory to find the coverage info file in. * @return phpunit_coverage_info */ - protected static function get_coverage_info(string $fulldir): ?phpunit_coverage_info { + protected static function get_coverage_info(string $fulldir): phpunit_coverage_info { $coverageconfig = "{$fulldir}/tests/coverage.php"; if (file_exists($coverageconfig)) { $coverageinfo = require($coverageconfig); @@ -984,7 +984,7 @@ class phpunit_util extends testing_util { return $coverageinfo; } - return null; + return new phpunit_coverage_info();; } /** diff --git a/lib/phpunit/tests/phpunit_dataset_test.php b/lib/phpunit/tests/phpunit_dataset_test.php index 4bf4d772125..4e0aa982f74 100644 --- a/lib/phpunit/tests/phpunit_dataset_test.php +++ b/lib/phpunit/tests/phpunit_dataset_test.php @@ -34,7 +34,7 @@ use org\bovigo\vfs\vfsStream; /** * Test phpunit_dataset features. * - * @coversDefaultClass phpunit_dataset + * @coversDefaultClass \phpunit_dataset */ class phpunit_dataset_test extends advanced_testcase { diff --git a/lib/table/tests/coverage.php b/lib/table/tests/coverage.php deleted file mode 100644 index eee7b6ceb13..00000000000 --- a/lib/table/tests/coverage.php +++ /dev/null @@ -1,50 +0,0 @@ -. - -declare(strict_types=1); - -defined('MOODLE_INTERNAL') || die(); - -/** - * Coverage information for the core_table component. - * - * @package core_table - * @category test - * @copyright 2020 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * Coverage information for the core_table subsystem. - * - * @copyright 2020 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -return new class extends phpunit_coverage_info { - /** @var array The list of folders relative to the plugin root to include in coverage generation. */ - protected $includelistfolders = [ - 'classes', - ]; - - /** @var array The list of files relative to the plugin root to include in coverage generation. */ - protected $includelistfiles = []; - - /** @var array The list of folders relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfolders = []; - - /** @var array The list of files relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfiles = []; -}; diff --git a/lib/tests/accesslib_has_capability_test.php b/lib/tests/accesslib_has_capability_test.php index c889fa630b4..fda323e038a 100644 --- a/lib/tests/accesslib_has_capability_test.php +++ b/lib/tests/accesslib_has_capability_test.php @@ -22,16 +22,15 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -defined('MOODLE_INTERNAL') || die(); - /** * Unit tests tests for has_capability. * * @package core * @copyright 2018 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers ::has_capability */ -class accesslib_has_capability_testcase extends \advanced_testcase { +class accesslib_has_capability_test extends \advanced_testcase { /** * Unit tests to check the operation of locked contexts. diff --git a/lib/tests/accesslib_test.php b/lib/tests/accesslib_test.php index 509e47e0daa..63dfc43c3db 100644 --- a/lib/tests/accesslib_test.php +++ b/lib/tests/accesslib_test.php @@ -25,13 +25,12 @@ defined('MOODLE_INTERNAL') || die(); - /** * Functional test for accesslib.php * * Note: execution may take many minutes especially on slower servers. */ -class core_accesslib_testcase extends advanced_testcase { +class accesslib_test extends advanced_testcase { /** * Verify comparison of context instances in phpunit asserts. */ @@ -48,6 +47,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test resetting works. + * + * @covers ::accesslib_clear_all_caches_for_unit_testing */ public function test_accesslib_clear_all_caches() { global $ACCESSLIB_PRIVATE; @@ -79,6 +80,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test getting of role access + * + * @covers ::get_role_access */ public function test_get_role_access() { global $DB; @@ -101,6 +104,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test getting of guest role. + * + * @covers ::get_guest_role */ public function test_get_guest_role() { global $CFG; @@ -114,6 +119,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test if user is admin. + * + * @covers ::is_siteadmin */ public function test_is_siteadmin() { global $DB, $CFG; @@ -156,6 +163,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test if user is enrolled in a course + * + * @covers ::is_enrolled */ public function test_is_enrolled() { global $DB; @@ -206,6 +215,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test logged in test. + * + * @covers ::isloggedin */ public function test_isloggedin() { global $USER; @@ -220,6 +231,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test guest user test. + * + * @covers ::isguestuser */ public function test_isguestuser() { global $DB; @@ -247,6 +260,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test capability riskiness. + * + * @covers ::is_safe_capability */ public function test_is_safe_capability() { global $DB; @@ -257,6 +272,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test context fetching. + * + * @covers ::get_context_info_array */ public function test_get_context_info_array() { $this->resetAfterTest(); @@ -324,6 +341,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test looking for course contacts. + * + * @covers ::has_coursecontact_role */ public function test_has_coursecontact_role() { global $DB, $CFG; @@ -348,6 +367,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test creation of roles. + * + * @covers ::create_role */ public function test_create_role() { global $DB; @@ -366,6 +387,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test adding of capabilities to roles. + * + * @covers ::assign_capability */ public function test_assign_capability() { global $DB, $USER; @@ -439,6 +462,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test removing of capabilities from roles. + * + * @covers ::unassign_capability */ public function test_unassign_capability() { global $DB, $USER; @@ -489,6 +514,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test role assigning. + * + * @covers ::role_assign */ public function test_role_assign() { global $DB, $USER; @@ -550,6 +577,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test role unassigning. + * + * @covers ::role_unassign */ public function test_role_unassign() { global $DB, $USER; @@ -599,6 +628,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test role unassigning. + * + * @covers ::role_unassign_all */ public function test_role_unassign_all() { global $DB; @@ -654,6 +685,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test role queries. + * + * @covers ::get_roles_with_capability */ public function test_get_roles_with_capability() { global $DB; @@ -687,6 +720,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test deleting of roles. + * + * @covers ::delete_role */ public function test_delete_role() { global $DB; @@ -744,6 +779,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test fetching of all roles. + * + * @covers ::get_all_roles */ public function test_get_all_roles() { global $DB; @@ -799,6 +836,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test getting of all archetypes. + * + * @covers ::get_role_archetypes */ public function test_get_role_archetypes() { $archetypes = get_role_archetypes(); @@ -810,6 +849,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test getting of roles with given archetype. + * + * @covers ::get_archetype_roles */ public function test_get_archetype_roles() { $this->resetAfterTest(); @@ -830,6 +871,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test aliased role names. + * + * @covers ::role_get_name */ public function test_role_get_name() { global $DB; @@ -881,6 +924,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test tweaking of role name arrays. + * + * @covers ::role_fix_names */ public function test_role_fix_names() { global $DB; @@ -937,6 +982,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test role default allows. + * + * @covers ::get_default_role_archetype_allows */ public function test_get_default_role_archetype_allows() { $archetypes = get_role_archetypes(); @@ -986,6 +1033,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test allowing of role assignments. + * + * @covers ::core_role_set_assign_allowed */ public function test_core_role_set_assign_allowed() { global $DB, $CFG; @@ -1019,6 +1068,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test allowing of role overrides. + * + * @covers ::core_role_set_override_allowed */ public function test_core_role_set_override_allowed() { global $DB, $CFG; @@ -1052,6 +1103,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test allowing of role switching. + * + * @covers ::core_role_set_switch_allowed */ public function test_core_role_set_switch_allowed() { global $DB, $CFG; @@ -1085,6 +1138,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test allowing of role switching. + * + * @covers ::core_role_set_view_allowed */ public function test_core_role_set_view_allowed() { global $DB, $CFG; @@ -1118,6 +1173,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test returning of assignable roles in context. + * + * @covers ::get_assignable_roles */ public function test_get_assignable_roles() { global $DB; @@ -1225,6 +1282,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test user count of assignable roles in context where users are assigned the role via different components. + * + * @covers ::get_assignable_roles */ public function test_get_assignable_roles_distinct_usercount() { global $DB; @@ -1258,6 +1317,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test getting of all switchable roles. + * + * @covers ::get_switchable_roles */ public function test_get_switchable_roles() { global $DB; @@ -1316,6 +1377,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test getting of all overridable roles. + * + * @covers ::get_overridable_roles */ public function test_get_overridable_roles() { global $DB; @@ -1409,6 +1472,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test getting of all overridable roles. + * + * @covers ::get_viewable_roles */ public function test_get_viewable_roles_course() { global $DB; @@ -1444,6 +1509,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test getting of all overridable roles. + * + * @covers ::get_viewable_roles */ public function test_get_viewable_roles_system() { global $DB; @@ -1477,6 +1544,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test we have context level defaults. + * + * @covers ::get_default_contextlevels */ public function test_get_default_contextlevels() { $archetypes = get_role_archetypes(); @@ -1492,6 +1561,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test role context level setup. + * + * @covers ::set_role_contextlevels */ public function test_set_role_contextlevels() { global $DB; @@ -1516,6 +1587,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test getting of role context levels + * + * @covers ::get_roles_for_contextlevels */ public function test_get_roles_for_contextlevels() { global $DB; @@ -1536,6 +1609,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test default enrol roles. + * + * @covers ::get_default_enrol_roles */ public function test_get_default_enrol_roles() { $this->resetAfterTest(); @@ -1564,6 +1639,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test getting of role users. + * + * @covers ::get_role_users */ public function test_get_role_users() { global $DB; @@ -1667,6 +1744,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test used role query. + * + * @covers ::get_roles_used_in_context */ public function test_get_roles_used_in_context() { global $DB; @@ -1707,6 +1786,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test roles used in course. + * + * @covers ::get_user_roles_in_course */ public function test_get_user_roles_in_course() { global $DB, $CFG; @@ -1773,6 +1854,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test get_user_roles and get_users_roles + * + * @covers ::get_user_roles */ public function test_get_user_roles() { global $DB, $CFG; @@ -1809,6 +1892,10 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test has_capability(), has_any_capability() and has_all_capabilities(). + * + * @covers ::has_capability + * @covers ::has_any_capability + * @covers ::has_all_capabilities */ public function test_has_capability_and_friends() { global $DB; @@ -1885,6 +1972,11 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that assigning a fake cap does not return. + * + * @covers ::get_users_by_capability + * @covers ::get_with_capability_join + * @covers ::get_with_capability_sql + * @covers ::has_capability */ public function test_fake_capability() { global $DB; @@ -1934,6 +2026,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that assigning a fake cap does not return. + * + * @covers ::assign_capability */ public function test_fake_capability_assign() { global $DB; @@ -1957,6 +2051,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that assigning a fake cap does not return. + * + * @covers ::unassign_capability */ public function test_fake_capability_unassign() { global $DB; @@ -1981,6 +2077,9 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that the caching in get_role_definitions() and get_role_definitions_uncached() * works as intended. + * + * @covers ::get_role_definitions + * @covers ::role_change_permission */ public function test_role_definition_caching() { global $DB; @@ -2048,6 +2147,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Tests get_user_capability_course() which checks a capability across all courses. + * + * @covers ::get_user_capability_course */ public function test_get_user_capability_course() { global $CFG, $USER; @@ -2328,6 +2429,9 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test if course creator future capability lookup works. + * + * @covers ::guess_if_creator_will_have_course_capability + * @covers ::has_capability */ public function test_guess_if_creator_will_have_course_capability() { global $DB, $CFG, $USER; @@ -2453,6 +2557,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test require_capability() exceptions. + * + * @covers ::require_capability */ public function test_require_capability() { $this->resetAfterTest(); @@ -2487,6 +2593,9 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that enrolled users SQL does not return any values for users in * other courses. + * + * @covers ::get_enrolled_users + * @covers ::get_suspended_userids */ public function test_get_enrolled_sql_different_course() { global $DB; @@ -2517,6 +2626,9 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that enrolled users SQL does not return any values for role * assignments without an enrolment. + * + * @covers ::get_enrolled_users + * @covers ::get_suspended_userids */ public function test_get_enrolled_sql_role_only() { global $DB; @@ -2545,6 +2657,9 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that multiple enrolments for the same user are counted correctly. + * + * @covers ::get_enrolled_users + * @covers ::get_suspended_userids */ public function test_get_enrolled_sql_multiple_enrolments() { global $DB; @@ -2594,6 +2709,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that enrolled users SQL does not return any values for users * without a group when $context is not a valid course context. + * + * @covers ::get_enrolled_users */ public function test_get_enrolled_sql_userswithoutgroup() { global $DB; @@ -2738,6 +2855,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * @dataProvider get_enrolled_sql_provider + * @covers ::get_enrolled_users + * @covers ::get_suspended_userids */ public function test_get_enrolled_sql_course($users, $counts) { global $DB; @@ -3664,6 +3783,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that context_system::get_capabilities returns capabilities relevant to all modules. + * + * @covers \context_system::get_capabilities */ public function test_context_module_caps_returned_by_get_capabilities_in_sys_context() { $actual = context_system::instance()->get_capabilities(); @@ -3677,6 +3798,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that context_coursecat::get_capabilities returns capabilities relevant to all modules. + * + * @covers \context_coursecat::get_capabilities */ public function test_context_module_caps_returned_by_get_capabilities_in_course_cat_context() { $this->resetAfterTest(true); @@ -3694,6 +3817,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that context_course::get_capabilities returns capabilities relevant to all modules. + * + * @covers \context_course::get_capabilities */ public function test_context_module_caps_returned_by_get_capabilities_in_course_context() { $this->resetAfterTest(true); @@ -3712,6 +3837,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that context_module::get_capabilities returns capabilities relevant to all modules. + * + * @covers \context_module::get_capabilities */ public function test_context_module_caps_returned_by_get_capabilities_mod_context() { $this->resetAfterTest(true); @@ -3731,6 +3858,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that {@see context_block::get_capabilities} returns capabilities relevant to blocks + * + * @covers \context_block::get_capabilities */ public function test_context_block_caps_returned_by_get_capabilities_block_context(): void { $this->resetAfterTest(); @@ -3759,6 +3888,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test that {@see context_user::get_capabilities} returns capabilities relevant to users + * + * @covers \context_user::get_capabilities */ public function test_context_user_caps_returned_by_get_capabilities_user_context(): void { $this->resetAfterTest(); @@ -3783,6 +3914,9 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test updating of role capabilities during upgrade + * + * @covers ::update_capabilities + * @covers ::update_capabilities */ public function test_update_capabilities() { global $DB, $SITE; @@ -3868,6 +4002,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Tests reset_role_capabilities function. + * + * @covers ::reset_role_capabilities */ public function test_reset_role_capabilities() { global $DB; @@ -3903,6 +4039,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Tests count_role_users function. + * + * @covers ::count_role_users */ public function test_count_role_users() { global $DB; @@ -3941,6 +4079,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test fetching users by capability. + * + * @covers ::get_users_by_capability */ public function test_get_users_by_capability() { global $DB; @@ -3990,6 +4130,10 @@ class core_accesslib_testcase extends advanced_testcase { $this->assertFalse(array_key_exists($guest->id, $users)); } + + /** + * @covers ::get_with_capability_sql + */ public function test_get_with_capability_sql() { global $DB; @@ -4063,6 +4207,7 @@ class core_accesslib_testcase extends advanced_testcase { * Test get_with_capability_join. * * @dataProvider get_get_with_capability_join_override_cases + * @covers ::get_with_capability_join * * @param bool $studentshouldbereturned whether, with this combination of capabilities, the student should be in the results. * @param array $capabilitiestoprevent capabilities to override to prevent in the course context. @@ -4110,6 +4255,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test the get_profile_roles() function. + * + * @covers ::get_profile_roles */ public function test_get_profile_roles() { global $DB; @@ -4308,6 +4455,13 @@ class core_accesslib_testcase extends advanced_testcase { * Ensure that the is_parent_of() function works as anticipated. * * @dataProvider is_parent_of_provider + * @covers \context::is_parent_of + * @covers \context_block::is_parent_of + * @covers \context_course::is_parent_of + * @covers \context_coursecat::is_parent_of + * @covers \context_module::is_parent_of + * @covers \context_system::is_parent_of + * @covers \context_user::is_parent_of * @param string $contextpath The path of the context being compared with * @param string $testpath The path of the context being compared * @param bool $testself Whether to check the current context @@ -4410,6 +4564,13 @@ class core_accesslib_testcase extends advanced_testcase { * Ensure that the is_child_of() function works as anticipated. * * @dataProvider is_child_of_provider + * @covers \context::is_child_of + * @covers \context_block::is_child_of + * @covers \context_course::is_child_of + * @covers \context_coursecat::is_child_of + * @covers \context_module::is_child_of + * @covers \context_system::is_child_of + * @covers \context_user::is_child_of * @param string $contextpath The path of the context being compared with * @param string $testpath The path of the context being compared * @param bool $testself Whether to check the current context @@ -4445,6 +4606,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Ensure that the get_parent_contexts() function limits the number of queries it performs. + * + * @covers ::get_parent_contexts */ public function test_get_parent_contexts_preload() { global $DB; @@ -4486,6 +4649,9 @@ class core_accesslib_testcase extends advanced_testcase { /** * Ensure that get_with_capability_sql and get_with_capability_join respect context locking. + * + * @covers ::get_with_capability_join + * @covers ::get_with_capability_sql */ public function test_get_with_capability_sql_locked() { global $DB; @@ -4573,6 +4739,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Ensure that get_users_by_capability respects context freezing. + * + * @covers ::get_users_by_capability */ public function test_get_users_by_capability_locked() { $this->resetAfterTest(); @@ -4650,6 +4818,8 @@ class core_accesslib_testcase extends advanced_testcase { /** * Test require_all_capabilities. + * + * @covers ::require_all_capabilities */ public function test_require_all_capabilities() { global $DB; diff --git a/lib/tests/adhoc_task_test.php b/lib/tests/adhoc_task_test.php index cc9b135e943..9be78c9e4d7 100644 --- a/lib/tests/adhoc_task_test.php +++ b/lib/tests/adhoc_task_test.php @@ -34,6 +34,7 @@ require_once(__DIR__ . '/fixtures/task_fixtures.php'); * @category task * @copyright 2013 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @coversDefaultClass \core\task\manager */ class core_adhoc_task_testcase extends advanced_testcase { @@ -59,6 +60,8 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test adhoc task failure retry backoff. + * + * @covers ::get_next_adhoc_task */ public function test_get_next_adhoc_task_fail_retry() { $this->resetAfterTest(true); @@ -90,6 +93,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test future adhoc task execution. + * @covers ::get_next_adhoc_task */ public function test_get_next_adhoc_task_future() { $this->resetAfterTest(true); @@ -112,6 +116,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test queueing an adhoc task belonging to a component, where we set the task component accordingly + * @covers ::queue_adhoc_task */ public function test_queue_adhoc_task_for_component(): void { $this->resetAfterTest(); @@ -125,6 +130,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test queueing an adhoc task belonging to a component, where we do not set the task component + * @covers ::queue_adhoc_task */ public function test_queue_task_for_component_without_set_component(): void { $this->resetAfterTest(); @@ -140,6 +146,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test queueing an adhoc task belonging to an invalid component, where we do not set the task component + * @covers ::queue_adhoc_task */ public function test_queue_task_for_invalid_component_without_set_component(): void { $this->resetAfterTest(); @@ -152,6 +159,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test empty set of adhoc tasks + * @covers ::get_adhoc_tasks */ public function test_get_adhoc_tasks_empty_set() { $this->resetAfterTest(true); @@ -161,6 +169,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test correct set of adhoc tasks is returned for class. + * @covers ::get_adhoc_tasks */ public function test_get_adhoc_tasks_result_set() { $this->resetAfterTest(true); @@ -192,6 +201,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Ensure that the reschedule_or_queue_adhoc_task function will schedule a new task if no tasks exist. + * @covers ::reschedule_or_queue_adhoc_task */ public function test_reschedule_or_queue_adhoc_task_no_existing() { $this->resetAfterTest(true); @@ -206,6 +216,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Ensure that the reschedule_or_queue_adhoc_task function will schedule a new task if a task for the same user does * not exist. + * @covers ::reschedule_or_queue_adhoc_task */ public function test_reschedule_or_queue_adhoc_task_different_user() { $this->resetAfterTest(true); @@ -228,6 +239,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Ensure that the reschedule_or_queue_adhoc_task function will schedule a new task if a task with different custom * data exists. + * @covers ::reschedule_or_queue_adhoc_task */ public function test_reschedule_or_queue_adhoc_task_different_data() { $this->resetAfterTest(true); @@ -248,6 +260,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Ensure that the reschedule_or_queue_adhoc_task function will not make any change for matching data if no time was * specified. + * @covers ::reschedule_or_queue_adhoc_task */ public function test_reschedule_or_queue_adhoc_task_match_no_change() { $this->resetAfterTest(true); @@ -271,6 +284,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Ensure that the reschedule_or_queue_adhoc_task function will update the run time if there are planned changes. + * @covers ::reschedule_or_queue_adhoc_task */ public function test_reschedule_or_queue_adhoc_task_match_update_runtime() { $this->resetAfterTest(true); @@ -300,6 +314,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test queue_adhoc_task "if not scheduled". + * @covers ::queue_adhoc_task */ public function test_queue_adhoc_task_if_not_scheduled() { $this->resetAfterTest(true); @@ -366,6 +381,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test that when no userid is specified, it returns empty from the DB * too. + * @covers \core\task\adhoc_task::get_userid */ public function test_adhoc_task_user_empty() { $this->resetAfterTest(true); @@ -385,6 +401,9 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test that when a userid is specified, that userid is subsequently * returned. + * + * @covers \core\task\adhoc_task::set_userid + * @covers \core\task\adhoc_task::get_userid */ public function test_adhoc_task_user_set() { $this->resetAfterTest(true); @@ -405,6 +424,8 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test get_concurrency_limit() method to return 0 by default. + * + * @covers \core\task\adhoc_task::get_concurrency_limit */ public function test_get_concurrency_limit() { $this->resetAfterTest(true); @@ -415,6 +436,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test get_concurrency_limit() method to return a default value set in config. + * @covers \core\task\adhoc_task::get_concurrency_limit */ public function test_get_concurrency_limit_default() { $this->resetAfterTest(true); @@ -426,6 +448,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test get_concurrency_limit() method to return a value for specific task class. + * @covers \core\task\adhoc_task::get_concurrency_limit */ public function test_get_concurrency_limit_for_task() { global $CFG; @@ -439,6 +462,7 @@ class core_adhoc_task_testcase extends advanced_testcase { /** * Test adhoc task sorting. + * @covers ::get_next_adhoc_task */ public function test_get_next_adhoc_task_sorting() { $this->resetAfterTest(true); diff --git a/lib/tests/adminlib_test.php b/lib/tests/adminlib_test.php index 89e29e3e096..a6dbc0f6a5c 100644 --- a/lib/tests/adminlib_test.php +++ b/lib/tests/adminlib_test.php @@ -76,6 +76,7 @@ class core_adminlib_testcase extends advanced_testcase { * Test which tables and column should be replaced. * * @dataProvider db_should_replace_dataprovider + * @covers ::db_should_replace * @param string $table name * @param string $column name * @param bool $expected whether it should be replaced @@ -88,6 +89,7 @@ class core_adminlib_testcase extends advanced_testcase { /** * Data provider for additional skip tables. * + * @covers ::db_should_replace * @return array */ public function db_should_replace_additional_skip_tables_dataprovider() { @@ -119,6 +121,7 @@ class core_adminlib_testcase extends advanced_testcase { * Test additional skip tables. * * @dataProvider db_should_replace_additional_skip_tables_dataprovider + * @covers ::db_should_replace * @param string $table name * @param string $column name * @param bool $expected whether it should be replaced diff --git a/lib/tests/ajaxlib_test.php b/lib/tests/ajaxlib_test.php index 4ce4ca9d2a4..009126be238 100644 --- a/lib/tests/ajaxlib_test.php +++ b/lib/tests/ajaxlib_test.php @@ -25,6 +25,10 @@ defined('MOODLE_INTERNAL') || die(); +/** + * @covers ::ajax_capture_output + * @covers ::ajax_check_captured_output + */ class core_ajaxlib_testcase extends advanced_testcase { /** @var string Original error log */ protected $oldlog; diff --git a/lib/tests/behat_lib_test.php b/lib/tests/behat_lib_test.php index ff4477da53b..fefaf4c3629 100644 --- a/lib/tests/behat_lib_test.php +++ b/lib/tests/behat_lib_test.php @@ -52,6 +52,7 @@ class behat_lib_test extends advanced_testcase { * Tests for behat_is_requested_url() function. * * @dataProvider url_provider + * @covers ::behat_is_requested_url * * @param string $url URL used with behat_is_requested_url() function. * @param bool $expectedvalue Expected value returned by behat_is_requested_url() function. diff --git a/lib/tests/content/export/exportable_items/exportable_filearea_test.php b/lib/tests/content/export/exportable_items/exportable_filearea_test.php index bae10175ab1..7e465ddfa4e 100644 --- a/lib/tests/content/export/exportable_items/exportable_filearea_test.php +++ b/lib/tests/content/export/exportable_items/exportable_filearea_test.php @@ -38,7 +38,7 @@ use stdClass; /** * Unit tests for the `exportable_filearea` export item class. * - * @coversDefaultClass core\content\exportable_items\exportable_filearea + * @coversDefaultClass \core\content\exportable_items\exportable_filearea */ class exportable_filearea_test extends advanced_testcase { diff --git a/lib/tests/content/export/exportable_items/exportable_stored_file_test.php b/lib/tests/content/export/exportable_items/exportable_stored_file_test.php index a3fbb22fa41..61c760687c2 100644 --- a/lib/tests/content/export/exportable_items/exportable_stored_file_test.php +++ b/lib/tests/content/export/exportable_items/exportable_stored_file_test.php @@ -37,7 +37,7 @@ use stored_file; /** * Unit tests for the `exportable_stored_file` export item class. * - * @coversDefaultClass core\content\exportable_items\exportable_stored_file + * @coversDefaultClass \core\content\exportable_items\exportable_stored_file */ class exportable_stored_file_test extends advanced_testcase { diff --git a/lib/tests/content/export/exportable_items/exportable_textarea_test.php b/lib/tests/content/export/exportable_items/exportable_textarea_test.php index e42f0ca5952..5e11c3d2afe 100644 --- a/lib/tests/content/export/exportable_items/exportable_textarea_test.php +++ b/lib/tests/content/export/exportable_items/exportable_textarea_test.php @@ -38,7 +38,7 @@ use stdClass; /** * Unit tests for the `exportable_textarea` export item class. * - * @coversDefaultClass core\content\exportable_items\exportable_textarea + * @coversDefaultClass \core\content\exportable_items\exportable_textarea */ class exportable_textarea_test extends advanced_testcase { diff --git a/lib/tests/core_media_player_native.php b/lib/tests/core_media_player_native_test.php similarity index 99% rename from lib/tests/core_media_player_native.php rename to lib/tests/core_media_player_native_test.php index 362a0cd0a72..dc406410388 100644 --- a/lib/tests/core_media_player_native.php +++ b/lib/tests/core_media_player_native_test.php @@ -31,7 +31,7 @@ require_once(__DIR__ . '/fixtures/testable_core_media_player_native.php'); * * @package core * @category test - * @covers core_media_player_native + * @covers \core_media_player_native * @copyright 2019 Ruslan Kabalin * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/lib/tests/coverage.php b/lib/tests/coverage.php index 4cf41e8028c..f63fe8eccbb 100644 --- a/lib/tests/coverage.php +++ b/lib/tests/coverage.php @@ -34,20 +34,86 @@ defined('MOODLE_INTERNAL') || die(); return new class extends phpunit_coverage_info { /** @var array The list of folders relative to the plugin root to include in coverage generation. */ protected $includelistfolders = [ - 'classes', - // This is a legacy hangup which relates to parts of the file storage API being placed in the wrong location. 'filestorage', ]; /** @var array The list of files relative to the plugin root to include in coverage generation. */ - protected $includelistfiles = []; + protected $includelistfiles = [ + 'accesslib.php', + 'adminlib.php', + 'authlib.php', + 'badgeslib.php', + 'blocklib.php', + 'boxlib.php', + 'clilib.php', + 'completionlib.php', + 'conditionlib.php', + 'configonlylib.php', + 'cronlib.php', + 'csslib.php', + 'customcheckslib.php', + 'dataformatlib.php', + 'datalib.php', + 'ddllib.php', + 'deprecatedlib.php', + 'dmllib.php', + 'dtllib.php', + 'editorlib.php', + 'enrollib.php', + 'environmentlib.php', + 'externallib.php', + 'filelib.php', + 'filterlib.php', + 'flickrlib.php', + 'formslib.php', + 'gdlib.php', + 'gradelib.php', + 'graphlib.php', + 'grouplib.php', + 'installlib.php', + 'jslib.php', + 'ldaplib.php', + 'licenselib.php', + 'listlib.php', + 'mathslib.php', + 'messagelib.php', + 'modinfolib.php', + 'moodlelib.php', + 'myprofilelib.php', + 'navigationlib.php', + 'oauthlib.php', + 'outputactions.php', + 'outputcomponents.php', + 'outputfactories.php', + 'outputfragmentrequirementslib.php', + 'outputlib.php', + 'outputrenderers.php', + 'outputrequirementslib.php', + 'pagelib.php', + 'pdflib.php', + 'phpminimumversionlib.php', + 'plagiarismlib.php', + 'portfoliolib.php', + 'questionlib.php', + 'resourcelib.php', + 'rsslib.php', + 'searchlib.php', + 'sessionlib.php', + 'setuplib.php', + 'soaplib.php', + 'statslib.php', + 'tablelib.php', + 'tokeniserlib.php', + 'upgradelib.php', + 'uploadlib.php', + 'webdavlib.php', + 'weblib.php', + 'xsendfilelib.php', + ]; /** @var array The list of folders relative to the plugin root to exclude from coverage generation. */ protected $excludelistfolders = [ 'filestorage/tests', ]; - - /** @var array The list of files relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfiles = []; }; diff --git a/lib/tests/date_test.php b/lib/tests/date_test.php index 3cdaf211621..844f1200b0f 100644 --- a/lib/tests/date_test.php +++ b/lib/tests/date_test.php @@ -32,8 +32,13 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2015 Totara Learning Solutions Ltd {@link http://www.totaralms.com/} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @author Petr Skoda + * @covers \core_date + * @coversDefaultClass \core_date */ -class core_date_testcase extends advanced_testcase { +class date_test extends advanced_testcase { + /** + * @covers ::get_default_php_timezone + */ public function test_get_default_php_timezone() { $this->resetAfterTest(); @@ -50,6 +55,9 @@ class core_date_testcase extends advanced_testcase { $this->assertSame('GMT', core_date::get_default_php_timezone()); } + /** + * @covers ::normalise_timezone + */ public function test_normalise_timezone() { $this->resetAfterTest(); @@ -114,6 +122,9 @@ class core_date_testcase extends advanced_testcase { $this->assertSame('Pacific/Auckland', core_date::normalise_timezone($tz)); } + /** + * @covers ::normalise_timezone + */ public function test_windows_conversion() { $file = __DIR__ . '/fixtures/timezonewindows.xml'; @@ -175,6 +186,9 @@ class core_date_testcase extends advanced_testcase { } } + /** + * @covers ::get_localised_timezone + */ public function test_get_localised_timezone() { $this->resetAfterTest(); @@ -202,6 +216,9 @@ class core_date_testcase extends advanced_testcase { $this->assertSame('UTC', $result); } + /** + * @covers ::get_list_of_timezones + */ public function test_get_list_of_timezones() { $this->resetAfterTest(); @@ -250,6 +267,9 @@ class core_date_testcase extends advanced_testcase { } + /** + * @covers ::get_server_timezone + */ public function test_get_server_timezone() { global $CFG; $this->resetAfterTest(); @@ -275,6 +295,9 @@ class core_date_testcase extends advanced_testcase { $this->assertSame('Europe/Prague', core_date::get_server_timezone()); } + /** + * @covers ::get_server_timezone_object + */ public function test_get_server_timezone_object() { $this->resetAfterTest(); @@ -287,6 +310,9 @@ class core_date_testcase extends advanced_testcase { } } + /** + * @covers ::set_default_server_timezone + */ public function test_set_default_server_timezone() { global $CFG; $this->resetAfterTest(); @@ -405,6 +431,7 @@ class core_date_testcase extends advanced_testcase { /** * @dataProvider legacyUserTimezoneProvider + * @covers ::get_user_timezone * @param string $tz The legacy timezone. * @param string $expected The expected converted timezone. */ @@ -413,6 +440,9 @@ class core_date_testcase extends advanced_testcase { $this->assertEquals($expected, core_date::get_user_timezone($tz)); } + /** + * @covers ::get_user_timezone + */ public function test_get_user_timezone() { global $CFG, $USER; $this->resetAfterTest(); @@ -549,6 +579,9 @@ class core_date_testcase extends advanced_testcase { $this->assertSame('Pacific/Auckland', core_date::get_user_timezone($tz)); } + /** + * @covers ::get_user_timezone_object + */ public function test_get_user_timezone_object() { global $CFG, $USER; $this->resetAfterTest(); diff --git a/lib/tests/external/dynamic_tabs_get_content_test.php b/lib/tests/external/dynamic_tabs_get_content_test.php index 02471676953..b30fdc1cddb 100644 --- a/lib/tests/external/dynamic_tabs_get_content_test.php +++ b/lib/tests/external/dynamic_tabs_get_content_test.php @@ -30,7 +30,7 @@ require_once($CFG->dirroot . '/lib/tests/fixtures/testeable_dynamic_tab.php'); * Unit tests external dynamic tabs get content * * @package core - * @covers core\external\dynamic_tabs_get_content + * @covers \core\external\dynamic_tabs_get_content * @copyright 2021 David Matamoros * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/lib/tests/external/output/icon_system/load_fontawesome_map_test.php b/lib/tests/external/output/icon_system/load_fontawesome_map_test.php index 5f94b7ac191..5e970a42f4b 100644 --- a/lib/tests/external/output/icon_system/load_fontawesome_map_test.php +++ b/lib/tests/external/output/icon_system/load_fontawesome_map_test.php @@ -38,7 +38,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php'); * * @copyright 2020 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @coversDefaultClass core\external\output\icon_system\load_fontawesome_map + * @coversDefaultClass \core\external\output\icon_system\load_fontawesome_map */ class load_fontawesome_map_test extends externallib_advanced_testcase { diff --git a/lib/tests/external/record_userfeedback_action_test.php b/lib/tests/external/record_userfeedback_action_test.php index 4a4507f1f21..fa99bebe79d 100644 --- a/lib/tests/external/record_userfeedback_action_test.php +++ b/lib/tests/external/record_userfeedback_action_test.php @@ -39,7 +39,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php'); * * @copyright 2020 Shamim Rezaie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @coversDefaultClass record_userfeedback_action + * @coversDefaultClass \core\external\record_userfeedback_action */ class record_userfeedback_action_test extends externallib_advanced_testcase { diff --git a/lib/tests/html_writer_test.php b/lib/tests/html_writer_test.php index c2431b85566..e732269d18d 100644 --- a/lib/tests/html_writer_test.php +++ b/lib/tests/html_writer_test.php @@ -28,67 +28,104 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; require_once($CFG->libdir . '/outputcomponents.php'); - /** * Unit tests for the html_writer class. * * @copyright 2010 Tim Hunt * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers \html_writer + * @coversDefaultClass \html_writer */ -class core_html_writer_testcase extends basic_testcase { +class html_writer_test extends basic_testcase { + /** + * @covers ::start_tag + */ public function test_start_tag() { $this->assertSame('
', html_writer::start_tag('div')); } + /** + * @covers ::start_tag + */ public function test_start_tag_with_attr() { $this->assertSame('
', html_writer::start_tag('div', array('class' => 'frog'))); } + /** + * @covers ::start_tag + */ public function test_start_tag_with_attrs() { $this->assertSame('
', html_writer::start_tag('div', array('class' => 'frog', 'id' => 'mydiv'))); } + /** + * @covers ::end_tag + */ public function test_end_tag() { $this->assertSame('
', html_writer::end_tag('div')); } + /** + * @covers ::empty_Tag + */ public function test_empty_tag() { $this->assertSame('
', html_writer::empty_tag('br')); } + /** + * @covers ::empty_Tag + */ public function test_empty_tag_with_attrs() { $this->assertSame('', html_writer::empty_tag('input', array('type' => 'submit', 'value' => 'frog'))); } + /** + * @covers ::nonempty_tag + */ public function test_nonempty_tag_with_content() { $this->assertSame('
Hello world!
', html_writer::nonempty_tag('div', 'Hello world!')); } + /** + * @covers ::nonempty_tag + */ public function test_nonempty_tag_empty() { $this->assertSame('', html_writer::nonempty_tag('div', '')); } + /** + * @covers ::nonempty_tag + */ public function test_nonempty_tag_null() { $this->assertSame('', html_writer::nonempty_tag('div', null)); } + /** + * @covers ::nonempty_tag + */ public function test_nonempty_tag_zero() { $this->assertSame('
0
', html_writer::nonempty_tag('div', 0, array('class' => 'score'))); } + /** + * @covers ::nonempty_tag + */ public function test_nonempty_tag_zero_string() { $this->assertSame('
0
', html_writer::nonempty_tag('div', '0', array('class' => 'score'))); } + /** + * @covers ::div + */ public function test_div() { // All options. $this->assertSame('
ribbit
', @@ -107,6 +144,9 @@ class core_html_writer_testcase extends basic_testcase { html_writer::div('ribbit')); } + /** + * @covers ::start_div + */ public function test_start_div() { // All options. $this->assertSame('
', @@ -125,10 +165,16 @@ class core_html_writer_testcase extends basic_testcase { html_writer::start_div()); } + /** + * @covers ::end_div + */ public function test_end_div() { $this->assertSame('
', html_writer::end_div()); } + /** + * @covers ::span + */ public function test_span() { // All options. $this->assertSame('ribbit', @@ -147,6 +193,9 @@ class core_html_writer_testcase extends basic_testcase { html_writer::span('ribbit')); } + /** + * @covers ::start_span + */ public function test_start_span() { // All options. $this->assertSame('', @@ -165,10 +214,19 @@ class core_html_writer_testcase extends basic_testcase { html_writer::start_span()); } + /** + * @covers ::end_span + */ public function test_end_span() { $this->assertSame('', html_writer::end_span()); } + /** + * @covers ::table + * @covers \html_table_row + * @covers \html_table_cell + * @covers \html_table + */ public function test_table() { $row = new html_table_row(); @@ -220,6 +278,9 @@ EOF; $this->assertSame($expected, $output); } + /** + * @covers ::table + */ public function test_table_hidden_caption() { $table = new html_table(); diff --git a/lib/tests/modinfolib_test.php b/lib/tests/modinfolib_test.php index 0f6222871c2..4201d95f2fc 100644 --- a/lib/tests/modinfolib_test.php +++ b/lib/tests/modinfolib_test.php @@ -925,7 +925,7 @@ class modinfolib_test extends advanced_testcase { * Test test_get_section_info_by_id method * * @dataProvider get_section_info_by_id_provider - * @covers ::get_section_info_by_id + * @covers \course_modinfo::get_section_info_by_id * * @param int $sectionnum the section number * @param int $strictness the search strict mode diff --git a/lib/tests/oauth2_test.php b/lib/tests/oauth2_test.php index 4da5d1e56b0..c2b206a40a5 100644 --- a/lib/tests/oauth2_test.php +++ b/lib/tests/oauth2_test.php @@ -30,6 +30,7 @@ defined('MOODLE_INTERNAL') || die(); * @package core * @copyright 2017 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + * @coversDefaultClass \core\oauth2\api */ class core_oauth2_testcase extends advanced_testcase { diff --git a/lib/tests/output/icon_system_test.php b/lib/tests/output/icon_system_test.php index d018ed6b1c7..6d83c67e725 100644 --- a/lib/tests/output/icon_system_test.php +++ b/lib/tests/output/icon_system_test.php @@ -31,7 +31,7 @@ use coding_exception; /** * Unit tests for the `icon_system` class. * - * @coversDefaultClass core\output\icon_system + * @coversDefaultClass \core\output\icon_system */ class icon_system_test extends advanced_testcase { /** diff --git a/lib/tests/output/mustache_clean_string_helper_test.php b/lib/tests/output/mustache_clean_string_helper_test.php index a8eedb83214..73d74fe21b8 100644 --- a/lib/tests/output/mustache_clean_string_helper_test.php +++ b/lib/tests/output/mustache_clean_string_helper_test.php @@ -25,7 +25,7 @@ namespace core\output; * @category test * @copyright 2021 Shamim Rezaie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @coversDefaultClass mustache_clean_string_helper + * @coversDefaultClass \core\output\mustache_clean_string_helper */ class mustache_clean_string_helper_test extends \basic_testcase { diff --git a/lib/tests/theme_config_test.php b/lib/tests/theme_config_test.php index 87982bdc618..1c62f3a6f6c 100644 --- a/lib/tests/theme_config_test.php +++ b/lib/tests/theme_config_test.php @@ -33,8 +33,10 @@ require_once($CFG->libdir . '/outputlib.php'); * * @copyright 2012 Sam Hemelryk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers \theme_config + * @coversDefaultClass \theme_config */ -class core_theme_config_testcase extends advanced_testcase { +class theme_config_test extends advanced_testcase { /** * This function will test directives used to serve SVG images to make sure * this are making the right decisions. @@ -129,6 +131,8 @@ class core_theme_config_testcase extends advanced_testcase { /** * This function will test custom device detection regular expression setting. + * + * @covers \core_useragent */ public function test_devicedetectregex() { global $CFG; @@ -216,6 +220,8 @@ class core_theme_config_testcase extends advanced_testcase { /** * Test that {@see theme_config::get_all_block_regions()} returns localised list of region names. + * + * @covers ::get_all_block_regions */ public function test_get_all_block_regions() { $this->resetAfterTest(); diff --git a/lib/tests/useragent_test.php b/lib/tests/useragent_test.php index 9765e9127ed..024b8a4ff3a 100644 --- a/lib/tests/useragent_test.php +++ b/lib/tests/useragent_test.php @@ -14,22 +14,15 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Tests the user agent class. - * - * @package core - * @copyright 2013 Sam Hemelryk - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - /** * User agent test suite. * * @package core * @copyright 2013 Sam Hemelryk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers \core_useragent */ -class core_useragent_testcase extends advanced_testcase { +class useragent_test extends advanced_testcase { /** * Restores the user agent to the default one. @@ -38,6 +31,11 @@ class core_useragent_testcase extends advanced_testcase { core_useragent::instance(true); } + /** + * Data provider for known user agents. + * + * @return array + */ public function user_agents_providers() { // Note: When adding new entries to this list, please ensure that any new browser versions are added to the corresponding list. // This ensures that regression tests are applied to all known user agents. @@ -1638,7 +1636,6 @@ class core_useragent_testcase extends advanced_testcase { } } - /** * @dataProvider user_agents_providers */ diff --git a/lib/tests/weblib_test.php b/lib/tests/weblib_test.php index bed77bb2053..8fa7d6a9924 100644 --- a/lib/tests/weblib_test.php +++ b/lib/tests/weblib_test.php @@ -24,11 +24,11 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License */ -defined('MOODLE_INTERNAL') || die(); - - -class core_weblib_testcase extends advanced_testcase { +class weblib_test extends advanced_testcase { + /** + * @covers ::format_string + */ public function test_format_string() { global $CFG; @@ -113,6 +113,9 @@ class core_weblib_testcase extends advanced_testcase { $this->assertMatchesRegularExpression("/$expectedfilter/", $cachedresult); } + /** + * @covers ::s + */ public function test_s() { // Special cases. $this->assertSame('0', s(0)); @@ -163,6 +166,9 @@ class core_weblib_testcase extends advanced_testcase { } } + /** + * @covers ::format_text_email + */ public function test_format_text_email() { $this->assertSame("This is a TEST\n", format_text_email('

This is a test

', FORMAT_HTML)); @@ -176,6 +182,9 @@ class core_weblib_testcase extends advanced_testcase { format_text_email('習習', FORMAT_HTML)); } + /** + * @covers ::obfuscate_email + */ public function test_obfuscate_email() { $email = 'some.user@example.com'; $obfuscated = obfuscate_email($email); @@ -184,6 +193,9 @@ class core_weblib_testcase extends advanced_testcase { $this->assertSame($email, $back); } + /** + * @covers ::obfuscate_text + */ public function test_obfuscate_text() { $text = 'Žluťoučký koníček 32131'; $obfuscated = obfuscate_text($text); @@ -192,6 +204,9 @@ class core_weblib_testcase extends advanced_testcase { $this->assertSame($text, $back); } + /** + * @covers ::highlight + */ public function test_highlight() { $this->assertSame('This is good', highlight('good', 'This is good')); @@ -230,19 +245,31 @@ class core_weblib_testcase extends advanced_testcase { highlight('test -1', '

test 1

1

', false, '', '')); } + /** + * @covers ::replace_ampersands_not_followed_by_entity + */ public function test_replace_ampersands() { $this->assertSame("This & that  ", replace_ampersands_not_followed_by_entity("This & that  ")); $this->assertSame("This &nbsp that  ", replace_ampersands_not_followed_by_entity("This   that  ")); } + /** + * @covers ::strip_links + */ public function test_strip_links() { $this->assertSame('this is a link', strip_links('this is a link')); } + /** + * @covers ::wikify_links + */ public function test_wikify_links() { $this->assertSame('this is a link [ http://someaddress.com/query ]', wikify_links('this is a link')); } + /** + * @covers ::clean_text + */ public function test_clean_text() { $text = "lala xx"; $this->assertSame($text, clean_text($text, FORMAT_PLAIN)); @@ -251,6 +278,9 @@ class core_weblib_testcase extends advanced_testcase { $this->assertSame('lala xx', clean_text($text, FORMAT_HTML)); } + /** + * @covers ::qualified_me + */ public function test_qualified_me() { global $PAGE, $FULLME, $CFG; $this->resetAfterTest(); @@ -264,7 +294,10 @@ class core_weblib_testcase extends advanced_testcase { $this->assertSame($CFG->wwwroot.'/course/view.php?id=1', qualified_me()); } - public function test_null_progres_trace() { + /** + * @covers \null_progress_trace + */ + public function test_null_progress_trace() { $this->resetAfterTest(false); $trace = new null_progress_trace(); @@ -277,7 +310,10 @@ class core_weblib_testcase extends advanced_testcase { $this->expectOutputString(''); } - public function test_text_progres_trace() { + /** + * @covers \null_progress_trace + */ + public function test_text_progress_trace() { $this->resetAfterTest(false); $trace = new text_progress_trace(); @@ -288,7 +324,10 @@ class core_weblib_testcase extends advanced_testcase { $this->expectOutputString("do\n re\n mi\n"); } - public function test_html_progres_trace() { + /** + * @covers \html_progress_trace + */ + public function test_html_progress_trace() { $this->resetAfterTest(false); $trace = new html_progress_trace(); @@ -299,6 +338,9 @@ class core_weblib_testcase extends advanced_testcase { $this->expectOutputString("

do

\n

  re

\n

    mi

\n"); } + /** + * @covers \html_list_progress_trace + */ public function test_html_list_progress_trace() { $this->resetAfterTest(false); @@ -310,7 +352,10 @@ class core_weblib_testcase extends advanced_testcase { $this->expectOutputString("
    \n
  • do
      \n
    • re
        \n
      • mi
      • \n
      \n
    • \n
    \n
  • \n
\n"); } - public function test_progres_trace_buffer() { + /** + * @covers \progress_trace_buffer + */ + public function test_progress_trace_buffer() { $this->resetAfterTest(false); $trace = new progress_trace_buffer(new html_progress_trace()); @@ -336,7 +381,10 @@ class core_weblib_testcase extends advanced_testcase { $this->expectOutputString(''); } - public function test_combined_progres_trace() { + /** + * @covers \combined_progress_trace + */ + public function test_combined_progress_trace() { $this->resetAfterTest(false); $trace1 = new progress_trace_buffer(new html_progress_trace(), false); @@ -352,6 +400,9 @@ class core_weblib_testcase extends advanced_testcase { $this->expectOutputString(''); } + /** + * @covers ::set_debugging + */ public function test_set_debugging() { global $CFG; @@ -392,6 +443,9 @@ class core_weblib_testcase extends advanced_testcase { $this->assertFalse($CFG->debugdeveloper); } + /** + * @covers ::strip_pluginfile_content + */ public function test_strip_pluginfile_content() { $source = <<assertSame($expected, strip_pluginfile_content($source)); } + /** + * @covers \purify_html + */ public function test_purify_html_ruby() { $this->resetAfterTest(); @@ -452,6 +509,7 @@ EXPECTED; * @param int|false $format The content format * @param string $expected Expected value * @dataProvider provider_content_to_text + * @covers ::content_to_text */ public function test_content_to_text($content, $format, $expected) { $content = content_to_text($content, $format); @@ -628,6 +686,7 @@ EXPECTED; * @param string $email the email address to test * @param boolean $result Expected result (true or false) * @dataProvider data_validate_email + * @covers ::validate_email */ public function test_validate_email($email, $result) { if ($result) { @@ -752,6 +811,7 @@ EXPECTED; * @param string $cfgslasharguments slasharguments setting. * @param string|false $expected Expected value. * @dataProvider provider_get_file_argument + * @covers ::get_file_argument */ public function test_get_file_argument($server, $cfgslasharguments, $expected) { global $CFG; @@ -796,6 +856,8 @@ EXPECTED; /** * Tests for extract_draft_file_urls_from_text() function. + * + * @covers ::extract_draft_file_urls_from_text */ public function test_extract_draft_file_urls_from_text() { global $CFG; @@ -842,6 +904,9 @@ EXPECTED; $this->assertEquals($draftareas, $extracteddraftareas); } + /** + * @covers ::print_password_policy + */ public function test_print_password_policy() { $this->resetAfterTest(true); global $CFG; diff --git a/lib/upgrade.txt b/lib/upgrade.txt index b92efc0da92..a5dc0d015a5 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -153,6 +153,16 @@ such as the title and strings for continue and cancel buttons. * The method get_enabled_plugin($pluginname) has been added to the core_plugininfo\base class. It has a default implementation for all the plugininfo classes and it can be overwritten when required (like it has been done with filter). This method returns the current value for a pluginname depending on its status (enabled, disabled, other...). +* Unit Test coverage defaults have been updated to include some sensible defaults. + The default values now include: + * /classes/ + * /tests/generator/ + * /externallib.php + * /lib.php + * /locallib.php + * /renderer.php + * /rsslib.php + This default applies both when there is no supplied coverage.php file, and is used to supplement any existing coverage configuration file if one is found. === 3.11.4 === * A new option dontforcesvgdownload has been added to the $options parameter of the send_file() function. diff --git a/lib/xapi/tests/coverage.php b/lib/xapi/tests/coverage.php deleted file mode 100644 index 1a4f28beb5d..00000000000 --- a/lib/xapi/tests/coverage.php +++ /dev/null @@ -1,48 +0,0 @@ -. - -/** - * Coverage information for the core_xapi component. - * - * @package core_xapi - * @category test - * @copyright 2020 Ferran Recio - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -/** - * Coverage information for the core xAPI component. - * - * @copyright 2020 Ferran Recio - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -return new class extends phpunit_coverage_info { - /** @var array The list of folders relative to the plugin root to include in coverage generation. */ - protected $includelistfolders = [ - 'classes', - ]; - - /** @var array The list of files relative to the plugin root to include in coverage generation. */ - protected $includelistfiles = []; - - /** @var array The list of folders relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfolders = []; - - /** @var array The list of files relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfiles = []; -}; diff --git a/mod/forum/tests/coverage.php b/mod/forum/tests/coverage.php deleted file mode 100644 index a9edb2473ed..00000000000 --- a/mod/forum/tests/coverage.php +++ /dev/null @@ -1,49 +0,0 @@ -. - -defined('MOODLE_INTERNAL') || die(); - -/** - * Coverage information for the mod_forum component. - * - * @package mod_forum - * @category phpunit - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * Coverage information for the core subsystem. - * - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -return new class extends phpunit_coverage_info { - /** @var array The list of folders relative to the plugin root to include in coverage generation. */ - protected $includelistfolders = [ - 'classes', - 'externallib.php', - ]; - - /** @var array The list of files relative to the plugin root to include in coverage generation. */ - protected $includelistfiles = []; - - /** @var array The list of folders relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfolders = []; - - /** @var array The list of files relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfiles = []; -}; diff --git a/mod/h5pactivity/tests/coverage.php b/mod/h5pactivity/tests/coverage.php deleted file mode 100644 index 9902daba6dc..00000000000 --- a/mod/h5pactivity/tests/coverage.php +++ /dev/null @@ -1,43 +0,0 @@ -. - -/** - * Coverage information for the mod_h5pactivity. - * - * @package mod_h5pactivity - * @category test - * @copyright 2021 Ferran Recio - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -return new class extends phpunit_coverage_info { - /** @var array The list of folders relative to the plugin root to include in coverage generation. */ - protected $includelistfolders = [ - 'classes', - 'tests/generator', - ]; - - /** @var array The list of files relative to the plugin root to include in coverage generation. */ - protected $includelistfiles = []; - - /** @var array The list of folders relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfolders = []; - - /** @var array The list of files relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfiles = []; -}; diff --git a/privacy/tests/coverage.php b/privacy/tests/coverage.php deleted file mode 100644 index da0e4001f36..00000000000 --- a/privacy/tests/coverage.php +++ /dev/null @@ -1,49 +0,0 @@ -. - -defined('MOODLE_INTERNAL') || die(); - -/** - * Coverage information for the tool_dataprivacy plugin. - * - * @package core - * @category phpunit - * @copyright 2018 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * Coverage information for the tool_dataprivacy plugin. - * - * @copyright 2018 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -return new class extends phpunit_coverage_info { - /** @var array The list of folders relative to the plugin root o include in coverage generation. */ - protected $includelistfolders = [ - 'classes', - ]; - - /** @var array The list of files relative to the plugin root to include in coverage generation. */ - protected $includelistfiles = []; - - /** @var array The list of folders relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfolders = [ - ]; - - /** @var array The list of files relative to the plugin root to exclude from coverage generation. */ - protected $excludelistfiles = []; -}; diff --git a/question/bank/usage/tests/question_usage_test.php b/question/bank/usage/tests/question_usage_test.php index e170d3adbc6..3994c82d224 100644 --- a/question/bank/usage/tests/question_usage_test.php +++ b/question/bank/usage/tests/question_usage_test.php @@ -24,7 +24,7 @@ namespace qbank_usage; * @author Safat Shahin * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @coversDefaultClass \qbank_usage\tables\question_usage_table - * @covers qbank_usage_output_fragment_question_usage + * @covers \qbank_usage_output_fragment_question_usage */ class question_usage_test extends \advanced_testcase { diff --git a/reportbuilder/tests/coverage.php b/reportbuilder/tests/coverage.php deleted file mode 100644 index 1948492a919..00000000000 --- a/reportbuilder/tests/coverage.php +++ /dev/null @@ -1,43 +0,0 @@ -. - -/** - * Coverage information for core_reportbuilder - * - * @package core_reportbuilder - * @copyright 2020 Paul Holden - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -declare(strict_types=1); - -defined('MOODLE_INTERNAL') || die(); - -return new class extends phpunit_coverage_info { - /** @var array The list of folders relative to the plugin root to include in coverage generation. */ - protected $includelistfolders = [ - 'classes', - ]; - - /** @var array The list of files relative to the plugin root to include in coverage generation. */ - protected $includelistfiles = []; - - /** @var array The list of folders relative to the plugin root to exclude in coverage generation. */ - protected $excludelistfolders = []; - - /** @var array The list of files relative to the plugin root to exclude in coverage generation. */ - protected $excludelistfiles = []; -}; diff --git a/grade/grading/form/guide/tests/coverage.php b/user/tests/coverage.php similarity index 57% rename from grade/grading/form/guide/tests/coverage.php rename to user/tests/coverage.php index 4d4db5997e4..876c23f6de5 100644 --- a/grade/grading/form/guide/tests/coverage.php +++ b/user/tests/coverage.php @@ -15,27 +15,14 @@ // along with Moodle. If not, see . /** - * Coverage information for the gradingform_guide plugin. + * Coverage information for the core_user subsystem. * - * @package gradingform_guide - * @category test - * @copyright 2019 Andrew Nicols - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -/** - * Coverage information for the gradingform_guide plugin. - * - * @package gradingform_guide - * @copyright 2019 Andrew Nicols + * @copyright 2021 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ return new class extends phpunit_coverage_info { - // Array The list of folders relative to the plugin root to include in coverage generation. - protected $includelistfolders = [ - 'classes', - 'tests/generator', + /** @var array The list of files relative to the plugin root to include in coverage generation. */ + protected $includelistfiles = [ + 'editlib.php', ]; };