mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-82207 phpunit: fix various @covers annotations (take#1)
This fixes various (not all) wrong @covers annotations that are reported as warnings by PHPUnit when it's run with code-coverage enabled. When possible, the preferred solution is to change to @covers at class level, that is the recommended way. If multiple classes are involved, then a mix of @coversDefaultClass and @covers at method level are used (always trying to use the minimum needed patch). This is the first of a series of issues created as sub-tasks of MDL-82142.
This commit is contained in:
parent
ad7fc69c25
commit
ad5fe71868
53 changed files with 75 additions and 128 deletions
|
@ -23,7 +23,7 @@ namespace core_adminpresets;
|
|||
* @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 \core_adminpresets\helper
|
||||
*/
|
||||
class helper_test extends \advanced_testcase {
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ require_once("{$CFG->dirroot}/reportbuilder/tests/helpers.php");
|
|||
* Unit tests for roles datasource
|
||||
*
|
||||
* @package core_role
|
||||
* @covers \core_role\reportbuilder\datasource\roles;
|
||||
* @covers \core_role\reportbuilder\datasource\roles
|
||||
* @copyright 2024 Paul Holden <paulh@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
|
|
@ -320,7 +320,8 @@ class restore_stepslib_date_test extends \restore_date_testcase {
|
|||
/**
|
||||
* Checking that the user completion of an activity relating to the view field does not change
|
||||
* when doing a course restore.
|
||||
* @covers ::backup_and_restore
|
||||
* @covers \backup_userscompletion_structure_step
|
||||
* @covers \restore_userscompletion_structure_step
|
||||
*/
|
||||
public function test_usercompletion_view_restore(): void {
|
||||
global $DB;
|
||||
|
|
4
cache/tests/cache_test.php
vendored
4
cache/tests/cache_test.php
vendored
|
@ -2230,7 +2230,7 @@ class cache_test extends \advanced_testcase {
|
|||
/**
|
||||
* Test that locking before write works when writing across multiple layers.
|
||||
*
|
||||
* @covers \cache_loader
|
||||
* @covers \cache_application
|
||||
* @return void
|
||||
*/
|
||||
public function test_application_locking_multiple_layers(): void {
|
||||
|
@ -2310,7 +2310,7 @@ class cache_test extends \advanced_testcase {
|
|||
/**
|
||||
* Tests that locking fails correctly when either layer of a 2-layer cache has a lock already.
|
||||
*
|
||||
* @covers \cache_loader
|
||||
* @covers \cache_application
|
||||
*/
|
||||
public function test_application_locking_multiple_layers_failures(): void {
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ require_once($CFG->dirroot . '/calendar/lib.php');
|
|||
* @package core_calendar
|
||||
* @copyright 2017 Cameron Ball <cameron@cameron1729.xyz>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_calendar\local\event\container
|
||||
*/
|
||||
class container_test extends \advanced_testcase {
|
||||
|
||||
|
@ -370,7 +371,6 @@ class container_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Checks that completed activities events do not show.
|
||||
* @covers \core_calendar\local\event::init
|
||||
*/
|
||||
public function test_event_factory_with_completed_module_related_event(): void {
|
||||
global $CFG, $DB;
|
||||
|
|
|
@ -693,8 +693,11 @@ class lib_test extends \advanced_testcase {
|
|||
/**
|
||||
* Test that all get functions return custom fields data.
|
||||
*
|
||||
* @covers \cohort_get_cohort, \cohort_get_cohorts, \cohort_get_all_cohorts
|
||||
* @covers \cohort_get_available_cohorts, \cohort_get_user_cohorts
|
||||
* @covers ::cohort_get_cohort
|
||||
* @covers ::cohort_get_cohorts
|
||||
* @covers ::cohort_get_all_cohorts
|
||||
* @covers ::cohort_get_available_cohorts
|
||||
* @covers ::cohort_get_user_cohorts
|
||||
*/
|
||||
public function test_get_functions_return_custom_fields(): void {
|
||||
$this->resetAfterTest();
|
||||
|
@ -912,7 +915,7 @@ class lib_test extends \advanced_testcase {
|
|||
/**
|
||||
* Test that lib function returns custom field data for a cohorts.
|
||||
*
|
||||
* @covers \cohort_get_custom_fields_data
|
||||
* @covers ::cohort_get_custom_fields_data
|
||||
*/
|
||||
public function test_cohort_get_custom_fields_data(): void {
|
||||
$this->resetAfterTest();
|
||||
|
|
|
@ -280,9 +280,6 @@ class api_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test the adding and removing of members from room.
|
||||
*
|
||||
* @covers ::add_members_to_room
|
||||
* @covers ::remove_members_from_room
|
||||
*/
|
||||
public function test_adding_and_removing_of_room_membership(): void {
|
||||
$course = $this->get_course();
|
||||
|
@ -311,8 +308,6 @@ class api_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test the update of room membership with the change user role.
|
||||
*
|
||||
* @covers ::update_room_membership
|
||||
*/
|
||||
public function test_update_room_membership_on_user_role_change(): void {
|
||||
global $DB;
|
||||
|
@ -340,8 +335,6 @@ class api_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test sync_provider method for the sync of available provider.
|
||||
*
|
||||
* @covers ::sync_provider
|
||||
*/
|
||||
public function test_sync_provider(): void {
|
||||
// Generate the data.
|
||||
|
@ -358,8 +351,6 @@ class api_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test the removal of all members from the room.
|
||||
*
|
||||
* @covers ::remove_all_members_from_room
|
||||
*/
|
||||
public function test_remove_all_members_from_room(): void {
|
||||
$course = $this->get_course();
|
||||
|
@ -382,8 +373,6 @@ class api_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test the configuration of room changes as well as the membership with the change of provider.
|
||||
*
|
||||
* @covers ::configure_room_and_membership_by_provider
|
||||
*/
|
||||
public function test_configure_room_and_membership_by_provider(): void {
|
||||
global $DB;
|
||||
|
|
|
@ -48,7 +48,9 @@ class processor_test extends \advanced_testcase {
|
|||
*
|
||||
* @covers ::create_instance
|
||||
* @covers ::get_id
|
||||
* @covers ::get_instance
|
||||
* @covers ::get_context
|
||||
* @covers ::get_context_id
|
||||
* @covers ::get_provider
|
||||
* @covers ::get_room_name
|
||||
*/
|
||||
public function test_create_instance(): void {
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace core_completion;
|
|||
* @category test
|
||||
* @copyright 2017 Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_completion\api
|
||||
*/
|
||||
class api_test extends \advanced_testcase {
|
||||
|
||||
|
@ -292,7 +293,6 @@ class api_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test for mark_course_completions_activity_criteria() with different completionpassgrade settings.
|
||||
* @covers ::mark_course_completions_activity_criteria
|
||||
*/
|
||||
public function test_mark_course_completions_activity_criteria_completion_states(): void {
|
||||
global $DB, $CFG;
|
||||
|
|
|
@ -25,6 +25,7 @@ use completion_completion;
|
|||
* @category test
|
||||
* @copyright 2017 Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_completion\progress
|
||||
*/
|
||||
class progress_test extends \advanced_testcase {
|
||||
|
||||
|
@ -123,8 +124,6 @@ class progress_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Tests that the course progress percentage is returned correctly for various grade to pass settings
|
||||
*
|
||||
* @covers \core_completion\progress::get_course_progress_percentage.
|
||||
*/
|
||||
public function test_course_progress_percentage_completion_state(): void {
|
||||
global $DB, $CFG;
|
||||
|
|
|
@ -657,7 +657,7 @@ class contenttype_test extends \advanced_testcase {
|
|||
/**
|
||||
* Tests pluginfile result.
|
||||
*
|
||||
* @covers ::pluginfile
|
||||
* @covers ::__construct
|
||||
*/
|
||||
public function test_pluginfile(): void {
|
||||
$this->resetAfterTest();
|
||||
|
|
|
@ -40,7 +40,6 @@ class base_test extends advanced_testcase {
|
|||
* Tests the save and load functionality.
|
||||
*
|
||||
* @author Jason den Dulk
|
||||
* @covers \core_courseformat
|
||||
*/
|
||||
public function test_courseformat_saveandload(): void {
|
||||
$this->resetAfterTest();
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace core_courseformat;
|
|||
* @package core_courseformat
|
||||
* @copyright 2023 Ferran Recio <ferran@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core_courseformat\base
|
||||
* @coversDefaultClass \core_courseformat\formatactions
|
||||
*/
|
||||
class formatactions_test extends \advanced_testcase {
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ use cm_info;
|
|||
* @package core_courseformat
|
||||
* @copyright 2023 Ferran Recio <ferran@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core_courseformat\base
|
||||
* @coversDefaultClass \core_courseformat\local\baseactions
|
||||
*/
|
||||
class baseactions_test extends \advanced_testcase {
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@ use core_courseformat\hook\after_cm_name_edited;
|
|||
* @package core_courseformat
|
||||
* @copyright 2024 Ferran Recio <ferran@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core_courseformat\cmactions
|
||||
* @coversDefaultClass \core_courseformat\local\cmactions
|
||||
*/
|
||||
final class cmactions_test extends \advanced_testcase {
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@ use stdClass;
|
|||
* @package core_courseformat
|
||||
* @copyright 2023 Ferran Recio <ferran@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core_courseformat\sectionactions
|
||||
* @coversDefaultClass \core_courseformat\local\sectionactions
|
||||
*/
|
||||
class sectionactions_test extends \advanced_testcase {
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,9 @@ class state_test extends \advanced_testcase {
|
|||
* Test the behaviour of state::export_for_template().
|
||||
*
|
||||
* @dataProvider state_provider
|
||||
* @covers \core_courseformat\output\local\state
|
||||
* @covers \core_courseformat\output\local\state\course
|
||||
* @covers \core_courseformat\output\local\state\section
|
||||
* @covers \core_courseformat\output\local\state\cm
|
||||
*
|
||||
* @param string $format The course format of the course where the method will be executed.
|
||||
*/
|
||||
|
|
|
@ -575,7 +575,9 @@ class restore_test extends \advanced_testcase {
|
|||
* Tests course restore with editor in course format.
|
||||
*
|
||||
* @author Matthew Hilton
|
||||
* @covers \core_courseformat
|
||||
* @covers \core_courseformat\base
|
||||
* @covers \backup_course_structure_step
|
||||
* @covers \restore_course_structure_step
|
||||
*/
|
||||
public function test_restore_editor_courseformat(): void {
|
||||
$this->resetAfterTest();
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* @subpackage course
|
||||
* @copyright 2021 Tomo Tsuyuki <tomotsuyuki@catalyst-au.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_course\task\course_delete_modules
|
||||
*/
|
||||
namespace core_course;
|
||||
|
||||
|
@ -68,8 +69,6 @@ class course_delete_modules_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test with failed and successful cms
|
||||
*
|
||||
* @covers ::course_delete_modules
|
||||
*/
|
||||
public function test_delete_module_exception(): void {
|
||||
global $DB;
|
||||
|
|
|
@ -1739,7 +1739,7 @@ class enrollib_test extends advanced_testcase {
|
|||
/**
|
||||
* Test the behaviour of validate_enrol_plugin_data().
|
||||
*
|
||||
* @covers ::validate_enrol_plugin_data
|
||||
* @covers \enrol_plugin::validate_enrol_plugin_data
|
||||
*/
|
||||
public function test_validate_enrol_plugin_data(): void {
|
||||
$this->resetAfterTest();
|
||||
|
@ -1761,7 +1761,7 @@ class enrollib_test extends advanced_testcase {
|
|||
/**
|
||||
* Test the behaviour of update_enrol_plugin_data().
|
||||
*
|
||||
* @covers ::update_enrol_plugin_data
|
||||
* @covers \enrol_plugin::update_enrol_plugin_data
|
||||
*/
|
||||
public function test_update_enrol_plugin_data(): void {
|
||||
global $DB;
|
||||
|
|
3
grade/tests/external/get_feedback_test.php
vendored
3
grade/tests/external/get_feedback_test.php
vendored
|
@ -30,13 +30,13 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php');
|
|||
* @copyright 2023 Kevin Percy <kevin.percy@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 4.2
|
||||
* @covers \core_grades\external\get_feedback
|
||||
*/
|
||||
class get_feedback_test extends \externallib_advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test get_feedback.
|
||||
*
|
||||
* @covers ::get_feedback
|
||||
* @dataProvider get_feedback_provider
|
||||
* @param string|null $feedback The feedback text added for the grade item.
|
||||
* @param array $expected The expected feedback data.
|
||||
|
@ -103,7 +103,6 @@ class get_feedback_test extends \externallib_advanced_testcase {
|
|||
/**
|
||||
* Test get_feedback with invalid requests.
|
||||
*
|
||||
* @covers ::get_feedback
|
||||
* @dataProvider get_feedback_invalid_request_provider
|
||||
* @param string $loggeduserrole The role of the logged user.
|
||||
* @param bool $feedbacknotincourse Whether to request a feedback for a grade item which is not a part of the course.
|
||||
|
|
1
grade/tests/external/get_grade_tree_test.php
vendored
1
grade/tests/external/get_grade_tree_test.php
vendored
|
@ -37,7 +37,6 @@ class get_grade_tree_test extends \externallib_advanced_testcase {
|
|||
/**
|
||||
* Test the return value of the external function.
|
||||
*
|
||||
* @covers ::execute
|
||||
* @return void
|
||||
*/
|
||||
public function test_execute(): void {
|
||||
|
|
|
@ -883,7 +883,7 @@ class lib_test extends \advanced_testcase {
|
|||
/**
|
||||
* Tests set_groups_messaging
|
||||
*
|
||||
* @covers \core_group::set_groups_messaging
|
||||
* @covers ::set_groups_messaging
|
||||
*/
|
||||
public function test_set_groups_messaging(): void {
|
||||
$this->resetAfterTest();
|
||||
|
@ -923,7 +923,7 @@ class lib_test extends \advanced_testcase {
|
|||
/**
|
||||
* Tests set group messaging where it doesn't exist
|
||||
*
|
||||
* @covers \core_group::set_groups_messaging
|
||||
* @covers ::set_groups_messaging
|
||||
*/
|
||||
public function test_set_groups_messaging_doesnt_exist(): void {
|
||||
$this->resetAfterTest();
|
||||
|
|
|
@ -33,6 +33,7 @@ use zip_archive;
|
|||
* @copyright 2019 Victor Deniz <victor@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @runTestsInSeparateProcesses
|
||||
* @covers \core_h5p\file_storage
|
||||
*/
|
||||
class file_storage_test extends \advanced_testcase {
|
||||
|
||||
|
@ -847,8 +848,6 @@ class file_storage_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test H5P custom styles generation.
|
||||
*
|
||||
* @covers ::generate_custom_styles
|
||||
*/
|
||||
public function test_generate_custom_styles(): void {
|
||||
\set_config('h5pcustomcss', '.debug { color: #fab; }', 'core_h5p');
|
||||
|
@ -895,8 +894,6 @@ class file_storage_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test H5P custom styles retrieval.
|
||||
*
|
||||
* @covers ::get_custom_styles
|
||||
*/
|
||||
public function test_get_custom_styles(): void {
|
||||
global $CFG;
|
||||
|
|
|
@ -1099,8 +1099,6 @@ class framework_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test the behaviour of updateContent() with metadata.
|
||||
*
|
||||
* @covers ::updateContent
|
||||
*/
|
||||
public function test_updateContent_withmetadata(): void {
|
||||
global $DB;
|
||||
|
|
|
@ -205,7 +205,6 @@ class helper_test extends \advanced_testcase {
|
|||
* Test the behaviour of save_h5p() when the H5P file contains metadata.
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @covers ::save_h5p
|
||||
*/
|
||||
public function test_save_h5p_metadata(): void {
|
||||
global $DB;
|
||||
|
|
|
@ -291,8 +291,6 @@ class dml_read_slave_test extends \base_testcase {
|
|||
* so the latency parameter is applied properly.
|
||||
*
|
||||
* @return void
|
||||
* @covers ::can_use_readonly
|
||||
* @covers ::commit_delegated_transaction
|
||||
*/
|
||||
public function test_transaction(): void {
|
||||
$DB = $this->new_db(true);
|
||||
|
@ -339,8 +337,6 @@ class dml_read_slave_test extends \base_testcase {
|
|||
* so the latency parameter is applied properly.
|
||||
*
|
||||
* @return void
|
||||
* @covers ::can_use_readonly
|
||||
* @covers ::query_end
|
||||
*/
|
||||
public function test_long_update(): void {
|
||||
$DB = $this->new_db(true);
|
||||
|
@ -382,8 +378,6 @@ class dml_read_slave_test extends \base_testcase {
|
|||
* when the latency parameter is applied properly.
|
||||
*
|
||||
* @return void
|
||||
* @covers ::can_use_readonly
|
||||
* @covers ::commit_delegated_transaction
|
||||
*/
|
||||
public function test_transaction_with_events(): void {
|
||||
$this->with_global_db(function () {
|
||||
|
|
|
@ -530,8 +530,6 @@ EOD;
|
|||
|
||||
/**
|
||||
* Test the database debugging as SQL comment in anon class
|
||||
*
|
||||
* @covers ::add_sql_debugging
|
||||
*/
|
||||
public function test_sql_debugging_anon_class(): void {
|
||||
global $CFG;
|
||||
|
@ -3924,8 +3922,6 @@ EOD;
|
|||
|
||||
/**
|
||||
* Test DML libraries sql_cast_to_char method
|
||||
*
|
||||
* @covers ::sql_cast_to_char
|
||||
*/
|
||||
public function test_cast_to_char(): void {
|
||||
$DB = $this->tdb;
|
||||
|
|
|
@ -395,9 +395,6 @@ class pgsql_native_moodle_database_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test SSL connection.
|
||||
*
|
||||
* @return void
|
||||
* @covers ::raw_connect
|
||||
*/
|
||||
public function test_ssl_connection(): void {
|
||||
$pgconnerr = 'pg_connect(): Unable to connect to PostgreSQL server:';
|
||||
|
|
6
lib/external/tests/external_api_test.php
vendored
6
lib/external/tests/external_api_test.php
vendored
|
@ -332,7 +332,7 @@ class external_api_test extends \advanced_testcase {
|
|||
/**
|
||||
* Test \core_external\external_api::get_context()_from_params parameter validation.
|
||||
*
|
||||
* @covers \core_external\external_api::get_context
|
||||
* @covers \core_external\external_api::get_context_from_params
|
||||
*/
|
||||
public function test_get_context_params(): void {
|
||||
global $USER;
|
||||
|
@ -345,7 +345,7 @@ class external_api_test extends \advanced_testcase {
|
|||
/**
|
||||
* Test \core_external\external_api::get_context()_from_params parameter validation.
|
||||
*
|
||||
* @covers \core_external\external_api::get_context
|
||||
* @covers \core_external\external_api::get_context_from_params
|
||||
*/
|
||||
public function test_get_context_params2(): void {
|
||||
global $USER;
|
||||
|
@ -357,7 +357,7 @@ class external_api_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test \core_external\external_api::get_context()_from_params parameter validation.
|
||||
* @covers \core_external\external_api::get_context
|
||||
* @covers \core_external\external_api::get_context_from_params
|
||||
*/
|
||||
public function test_get_context_params3(): void {
|
||||
global $USER;
|
||||
|
|
|
@ -33,7 +33,6 @@ class stored_file_test extends advanced_testcase {
|
|||
/**
|
||||
* Test that the rotate_image() method does not rotate
|
||||
* an image that is not supposed to be rotated.
|
||||
* @covers ::rotate_image()
|
||||
*/
|
||||
public function test_rotate_image_does_not_rotate_image(): void {
|
||||
global $CFG;
|
||||
|
@ -62,7 +61,6 @@ class stored_file_test extends advanced_testcase {
|
|||
/**
|
||||
* Test that the rotate_image() method rotates an image
|
||||
* that is supposed to be rotated.
|
||||
* @covers ::rotate_image()
|
||||
*/
|
||||
public function test_rotate_image_rotates_image(): void {
|
||||
global $CFG;
|
||||
|
@ -94,8 +92,6 @@ class stored_file_test extends advanced_testcase {
|
|||
|
||||
/**
|
||||
* Ensure that get_content_file_handle returns a valid file handle.
|
||||
*
|
||||
* @covers ::get_psr_stream
|
||||
*/
|
||||
public function test_get_psr_stream(): void {
|
||||
global $CFG;
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace core;
|
|||
* @category phpunit
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core\testing_data_generator
|
||||
* @covers \testing_data_generator
|
||||
*/
|
||||
class testing_generator_test extends \advanced_testcase {
|
||||
public function test_get_plugin_generator_good_case(): void {
|
||||
|
|
|
@ -5260,7 +5260,7 @@ class accesslib_test extends advanced_testcase {
|
|||
/**
|
||||
* Test get_navigation_filter_context.
|
||||
*
|
||||
* @covers ::get_navigation_filter_context
|
||||
* @covers \core\context_helper::get_navigation_filter_context
|
||||
*/
|
||||
public function test_get_navigation_filter_context(): void {
|
||||
$this->resetAfterTest();
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace core;
|
|||
* @category test
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \auth_plugin_base
|
||||
*/
|
||||
class authlib_test extends \advanced_testcase {
|
||||
public function test_lockout(): void {
|
||||
|
@ -507,7 +508,6 @@ class authlib_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test the find_cli_user method
|
||||
* @covers ::find_cli_user
|
||||
*/
|
||||
public function test_find_cli_user(): void {
|
||||
global $CFG, $USER;
|
||||
|
@ -540,7 +540,6 @@ class authlib_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test the get_enabled_auth_plugin_classes method
|
||||
* @covers ::get_enabled_auth_plugin_classes
|
||||
*/
|
||||
public function test_get_enabled_auth_plugin_classes(): void {
|
||||
global $CFG;
|
||||
|
|
|
@ -26,7 +26,7 @@ use core\check\security\passwordpolicy;
|
|||
* @category check
|
||||
* @copyright 2020 Brendan Heywood <brendan@catalyst-au.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core\check
|
||||
* @covers \core\check\check
|
||||
*/
|
||||
class check_test extends \advanced_testcase {
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ class configonlylib_test extends \advanced_testcase {
|
|||
/**
|
||||
* Test the min_get_minimum_version function.
|
||||
*
|
||||
* @covers ::min_get_minimum_version
|
||||
* @covers ::min_get_minimum_revision
|
||||
*/
|
||||
public function test_min_get_minimum_version(): void {
|
||||
// This is fairly hard to write a test for, but we can at least check that it returns a number
|
||||
|
@ -161,7 +161,7 @@ class configonlylib_test extends \advanced_testcase {
|
|||
/**
|
||||
* Test the min_get_maximum_version function.
|
||||
*
|
||||
* @covers ::min_get_maximum_version
|
||||
* @covers ::min_get_maximum_revision
|
||||
*/
|
||||
public function test_min_get_maximum_version(): void {
|
||||
// The maximum version should be set to a time in the near future.
|
||||
|
|
|
@ -33,7 +33,7 @@ use stdClass;
|
|||
* @category test
|
||||
* @copyright 2020 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core\content\exportable_items\exportable_filearea
|
||||
* @covers \core\content\export\exportable_items\exportable_filearea
|
||||
*/
|
||||
class exportable_filearea_test extends advanced_testcase {
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ use stored_file;
|
|||
* @category test
|
||||
* @copyright 2020 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core\content\exportable_items\exportable_stored_file
|
||||
* @covers \core\content\export\exportable_items\exportable_stored_file
|
||||
*/
|
||||
class exportable_stored_file_test extends advanced_testcase {
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ use stdClass;
|
|||
* @category test
|
||||
* @copyright 2020 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core\content\exportable_items\exportable_textarea
|
||||
* @covers \core\content\export\exportable_items\exportable_textarea
|
||||
*/
|
||||
class exportable_textarea_test extends advanced_testcase {
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ use moodle_page;
|
|||
*/
|
||||
final class core_renderer_test extends \advanced_testcase {
|
||||
/**
|
||||
* @covers \core\hook\before_standard_top_of_body_html_generation
|
||||
* @covers \core\hook\output\before_standard_top_of_body_html_generation
|
||||
*/
|
||||
public function test_standard_top_of_body_html(): void {
|
||||
$page = new moodle_page();
|
||||
|
@ -42,7 +42,7 @@ final class core_renderer_test extends \advanced_testcase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \core\hook\before_standard_top_of_body_html_generation
|
||||
* @covers \core\hook\output\before_standard_top_of_body_html_generation
|
||||
*/
|
||||
public function test_before_standard_top_of_body_html_generation_hooked(): void {
|
||||
require_once(__DIR__ . '/fixtures/core_renderer/before_standard_top_of_body_html_generation_callbacks.php');
|
||||
|
@ -63,7 +63,7 @@ final class core_renderer_test extends \advanced_testcase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \core\hook\before_footer_html_generation
|
||||
* @covers \core\hook\output\before_footer_html_generation
|
||||
*/
|
||||
public function test_before_footer_html_generation(): void {
|
||||
$this->resetAfterTest();
|
||||
|
@ -79,7 +79,7 @@ final class core_renderer_test extends \advanced_testcase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \core\hook\before_footer_html_generation
|
||||
* @covers \core\hook\output\before_footer_html_generation
|
||||
*/
|
||||
public function test_before_footer_html_generation_hooked(): void {
|
||||
$this->resetAfterTest();
|
||||
|
@ -104,7 +104,7 @@ final class core_renderer_test extends \advanced_testcase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \core\hook\before_standard_footer_html_generation
|
||||
* @covers \core\hook\output\before_standard_footer_html_generation
|
||||
*/
|
||||
public function before_standard_footer_html_generation(): void {
|
||||
$page = new moodle_page();
|
||||
|
@ -116,7 +116,7 @@ final class core_renderer_test extends \advanced_testcase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \core\hook\before_standard_footer_html_generation
|
||||
* @covers \core\hook\output\before_standard_footer_html_generation
|
||||
*/
|
||||
public function test_before_standard_footer_html_generation_hooked(): void {
|
||||
require_once(__DIR__ . '/fixtures/core_renderer/before_standard_footer_html_generation_callbacks.php');
|
||||
|
@ -137,7 +137,7 @@ final class core_renderer_test extends \advanced_testcase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \core\hook\after_standard_main_region_html_generation
|
||||
* @covers \core\hook\output\after_standard_main_region_html_generation
|
||||
*/
|
||||
public function test_after_standard_main_region_html_generation(): void {
|
||||
$page = new moodle_page();
|
||||
|
@ -149,7 +149,7 @@ final class core_renderer_test extends \advanced_testcase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \core\hook\after_standard_main_region_html_generation
|
||||
* @covers \core\hook\output\after_standard_main_region_html_generation
|
||||
*/
|
||||
public function test_after_standard_main_region_html_generation_hooked(): void {
|
||||
require_once(__DIR__ . '/fixtures/core_renderer/after_standard_main_region_html_generation_callbacks.php');
|
||||
|
@ -170,7 +170,7 @@ final class core_renderer_test extends \advanced_testcase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \core\hook\before_html_attributes
|
||||
* @covers \core\hook\output\before_html_attributes
|
||||
*/
|
||||
public function test_htmlattributes(): void {
|
||||
$page = new moodle_page();
|
||||
|
@ -182,7 +182,7 @@ final class core_renderer_test extends \advanced_testcase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \core\hook\before_html_attributes
|
||||
* @covers \core\hook\output\before_html_attributes
|
||||
*/
|
||||
public function test_htmlattributes_hooked(): void {
|
||||
require_once(__DIR__ . '/fixtures/core_renderer/htmlattributes_callbacks.php');
|
||||
|
|
|
@ -35,9 +35,6 @@ class cron_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test the setup_user function.
|
||||
*
|
||||
* @covers ::setup_user
|
||||
* @covers ::reset_user_cache
|
||||
*/
|
||||
public function test_setup_user(): void {
|
||||
// This function uses the $GLOBALS super global. Disable the VariableNameLowerCase sniff for this function.
|
||||
|
|
|
@ -29,7 +29,7 @@ use \core\oauth2\user_field_mapping;
|
|||
* @package core
|
||||
* @copyright 2017 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
* @coversDefaultClass \core\oauth2\api
|
||||
* @covers \core\oauth2\api
|
||||
*/
|
||||
class oauth2_test extends \advanced_testcase {
|
||||
|
||||
|
@ -256,8 +256,6 @@ class oauth2_test extends \advanced_testcase {
|
|||
* Test endpoints creation for issuers.
|
||||
* @dataProvider create_endpoints_for_standard_issuer_provider
|
||||
*
|
||||
* @covers ::create_endpoints_for_standard_issuer
|
||||
*
|
||||
* @param string $type Issuer type to create.
|
||||
* @param string|null $discoveryurl Expected discovery URL or null if this endpoint doesn't exist.
|
||||
* @param bool $hasmappingfields True if it's expected the issuer to create has mapping fields.
|
||||
|
@ -495,7 +493,7 @@ class oauth2_test extends \advanced_testcase {
|
|||
* Test getting the list of internal fields.
|
||||
*
|
||||
* @dataProvider create_custom_profile_fields
|
||||
* @covers ::get_internalfield_list
|
||||
* @covers \core\oauth2\user_field_mapping::get_internalfield_list
|
||||
* @param array $given Categories and profile fields.
|
||||
* @param array $expected Expected value.
|
||||
*/
|
||||
|
@ -522,7 +520,7 @@ class oauth2_test extends \advanced_testcase {
|
|||
* Test getting the list of internal fields with flat array.
|
||||
*
|
||||
* @dataProvider create_custom_profile_fields
|
||||
* @covers ::get_internalfields
|
||||
* @covers \core\oauth2\user_field_mapping::get_internalfields
|
||||
* @param array $given Categories and profile fields.
|
||||
* @param array $expected Expected value.
|
||||
*/
|
||||
|
@ -542,7 +540,7 @@ class oauth2_test extends \advanced_testcase {
|
|||
/**
|
||||
* Test getting the list of empty external/custom profile fields.
|
||||
*
|
||||
* @covers ::get_internalfields
|
||||
* @covers \core\oauth2\user_field_mapping::get_internalfields
|
||||
*/
|
||||
public function test_get_empty_internalfield_list(): void {
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class choicelist_test extends advanced_testcase {
|
|||
/**
|
||||
* Test for a choice without options.
|
||||
*
|
||||
* @covers ::_construct
|
||||
* @covers ::__construct
|
||||
* @covers ::add_option
|
||||
* @covers ::export_for_template
|
||||
*/
|
||||
|
@ -57,7 +57,7 @@ class choicelist_test extends advanced_testcase {
|
|||
/**
|
||||
* Test for a choice with basic options.
|
||||
*
|
||||
* @covers ::_construct
|
||||
* @covers ::__construct
|
||||
* @covers ::add_option
|
||||
* @covers ::export_for_template
|
||||
*/
|
||||
|
@ -82,7 +82,7 @@ class choicelist_test extends advanced_testcase {
|
|||
/**
|
||||
* Test for a choice with extras options definition.
|
||||
*
|
||||
* @covers ::_construct
|
||||
* @covers ::__construct
|
||||
* @covers ::add_option
|
||||
* @covers ::set_option_extras
|
||||
* @covers ::export_for_template
|
||||
|
@ -126,7 +126,7 @@ class choicelist_test extends advanced_testcase {
|
|||
/**
|
||||
* Test for a choice with option selected.
|
||||
*
|
||||
* @covers ::_construct
|
||||
* @covers ::__construct
|
||||
* @covers ::add_option
|
||||
* @covers ::set_selected_value
|
||||
* @covers ::get_selected_value
|
||||
|
@ -196,7 +196,7 @@ class choicelist_test extends advanced_testcase {
|
|||
/**
|
||||
* Test for a choice with option selected.
|
||||
*
|
||||
* @covers ::_construct
|
||||
* @covers ::__construct
|
||||
* @covers ::add_option
|
||||
* @covers ::set_selected_value
|
||||
* @covers ::get_selected_value
|
||||
|
|
|
@ -24,6 +24,7 @@ use TCPDF_STATIC;
|
|||
* @package core
|
||||
* @copyright 2021 Brendan Heywood (brendan@catalyst-au.net)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \pdf
|
||||
*/
|
||||
class pdflib_test extends \advanced_testcase {
|
||||
|
||||
|
@ -70,7 +71,7 @@ class pdflib_test extends \advanced_testcase {
|
|||
/**
|
||||
* Test get_export_fontlist function.
|
||||
*
|
||||
* @covers ::get_export_fontlist
|
||||
* @covers \pdf::get_export_fontlist
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
@ -27,6 +27,7 @@ use testable_plugininfo_base;
|
|||
* @package core
|
||||
* @copyright 2019 Andrew Nicols
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core\plugininfo\base
|
||||
*/
|
||||
class base_test extends \advanced_testcase {
|
||||
|
||||
|
@ -277,7 +278,6 @@ class base_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Ensure that plugintype_supports_ordering() returns true.
|
||||
* @covers ::plugintype_supports_ordering
|
||||
*/
|
||||
public function test_plugintype_supports_ordering(): void {
|
||||
$this->assertFalse(base::plugintype_supports_ordering());
|
||||
|
|
|
@ -32,8 +32,6 @@ class block_test extends advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test the get_enabled_plugins method.
|
||||
*
|
||||
* @covers ::get_enabled_plugins
|
||||
*/
|
||||
public function test_get_enabled_plugins(): void {
|
||||
$this->resetAfterTest();
|
||||
|
|
|
@ -32,8 +32,6 @@ class media_test extends advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test the get_enabled_plugins method.
|
||||
*
|
||||
* @covers ::get_enabled_plugins
|
||||
*/
|
||||
public function test_get_enabled_plugins(): void {
|
||||
$this->resetAfterTest();
|
||||
|
|
|
@ -29,6 +29,7 @@ use core\moodlenet\share_recorder;
|
|||
* @category test
|
||||
* @copyright 2023 David Woloszyn <david.woloszyn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core\privacy\provider
|
||||
*/
|
||||
class provider_test extends provider_testcase {
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ require_once($CFG->libdir . '/tests/fixtures/testable_flexible_table.php');
|
|||
* @category test
|
||||
* @copyright 2013 Damyon Wiese <damyon@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \flexible_table
|
||||
*/
|
||||
class tablelib_test extends \advanced_testcase {
|
||||
protected function generate_columns($cols) {
|
||||
|
@ -796,9 +797,6 @@ class tablelib_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Data test for set and render caption for table.
|
||||
*
|
||||
* @covers ::set_caption_for_table
|
||||
* @covers ::render_caption_for_table
|
||||
*/
|
||||
public function test_set_and_render_caption_for_table(): void {
|
||||
$data = $this->generate_data(10, 2);
|
||||
|
|
|
@ -921,8 +921,7 @@ final class adhoc_task_test extends \advanced_testcase {
|
|||
/**
|
||||
* Test send messages when adhoc task reaches the max fail delay time.
|
||||
*
|
||||
* @covers ::adhoc_task_failed
|
||||
* @covers ::send_failed_task_max_delay_message
|
||||
* @covers \core\task\failed_task_callbacks::send_failed_task_max_delay_message
|
||||
*/
|
||||
public function test_adhoc_message_max_fail_delay(): void {
|
||||
$this->resetAfterTest();
|
||||
|
|
|
@ -35,7 +35,7 @@ class automated_backup_task_test extends \advanced_testcase {
|
|||
/**
|
||||
* Test the automated backup and report tasks.
|
||||
*
|
||||
* @covers \automated_backup_report_task::execute
|
||||
* @covers \core\task\automated_backup_report_task::execute
|
||||
* @covers \backup_cron_automated_helper::send_backup_status_to_admin
|
||||
* @covers \backup_cron_automated_helper::run_automated_backup
|
||||
* @covers \backup_cron_automated_helper::check_and_push_automated_backups
|
||||
|
|
|
@ -140,7 +140,6 @@ class file_temp_cleanup_task_test extends \basic_testcase {
|
|||
* @dataProvider cron_delete_from_temp_provider
|
||||
* @param array $nodes List of files and directories
|
||||
* @param array $expected The expected results
|
||||
* @covers ::execute
|
||||
*/
|
||||
public function test_cron_delete_from_temp($nodes, $expected): void {
|
||||
global $CFG;
|
||||
|
|
|
@ -26,7 +26,7 @@ require_once(__DIR__ . '/../fixtures/task_fixtures.php');
|
|||
* @category test
|
||||
* @copyright 2013 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core\task\scheduled_task
|
||||
* @covers \core\task\scheduled_task
|
||||
*/
|
||||
class scheduled_task_test extends \advanced_testcase {
|
||||
|
||||
|
@ -65,8 +65,6 @@ class scheduled_task_test extends \advanced_testcase {
|
|||
* @param int[] $expected
|
||||
*
|
||||
* @dataProvider eval_cron_provider
|
||||
*
|
||||
* @covers ::eval_cron_field
|
||||
*/
|
||||
public function test_eval_cron_field(string $field, int $min, int $max, array $expected): void {
|
||||
$testclass = new scheduled_test_task();
|
||||
|
@ -242,7 +240,6 @@ class scheduled_task_test extends \advanced_testcase {
|
|||
* @param string $month Month restriction list for task
|
||||
* @param string|int $expected Expected run time (strtotime format or time int)
|
||||
* @dataProvider get_next_scheduled_time_detail_provider
|
||||
* @covers ::get_next_scheduled_time
|
||||
*/
|
||||
public function test_get_next_scheduled_time_detail(string $now, string $minute, string $hour,
|
||||
string $day, string $dayofweek, string $month, string|int $expected): void {
|
||||
|
@ -271,8 +268,6 @@ class scheduled_task_test extends \advanced_testcase {
|
|||
*
|
||||
* We want frequent tasks to keep progressing as normal and not randomly stop for an hour, or
|
||||
* suddenly decide they need to happen in the past.
|
||||
*
|
||||
* @covers ::get_next_scheduled_time
|
||||
*/
|
||||
public function test_get_next_scheduled_time_dst_continuity(): void {
|
||||
$this->resetAfterTest();
|
||||
|
@ -987,10 +982,6 @@ class scheduled_task_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test disabling and enabling individual tasks.
|
||||
*
|
||||
* @covers ::disable
|
||||
* @covers ::enable
|
||||
* @covers ::has_default_configuration
|
||||
*/
|
||||
public function test_disable_and_enable_task(): void {
|
||||
$this->resetAfterTest();
|
||||
|
@ -1038,9 +1029,6 @@ class scheduled_task_test extends \advanced_testcase {
|
|||
|
||||
/**
|
||||
* Test send messages when a task reaches the max fail delay time.
|
||||
*
|
||||
* @covers ::scheduled_task_failed
|
||||
* @covers ::send_failed_task_max_delay_message
|
||||
*/
|
||||
public function test_message_max_fail_delay(): void {
|
||||
$this->resetAfterTest();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue