forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
53 changed files
with
75 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
* @category test | ||
* @copyright 2021 Sara Arjona ([email protected]) | ||
* @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 { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
* Unit tests for roles datasource | ||
* | ||
* @package core_role | ||
* @covers \core_role\reportbuilder\datasource\roles; | ||
* @covers \core_role\reportbuilder\datasource\roles | ||
* @copyright 2024 Paul Holden <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ | |
* @package core_calendar | ||
* @copyright 2017 Cameron Ball <[email protected]> | ||
* @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 @@ public function test_event_factory_with_completion_related_event(): void { | |
|
||
/** | ||
* 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; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
* @category test | ||
* @copyright 2017 Mark Nelson <[email protected]> | ||
* @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 @@ public function test_mark_course_completions_activity_criteria(): void { | |
|
||
/** | ||
* 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; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
* @category test | ||
* @copyright 2017 Mark Nelson <[email protected]> | ||
* @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 @@ public function test_course_progress_percentage_with_activities_and_course(): vo | |
|
||
/** | ||
* 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; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
* @package core_courseformat | ||
* @copyright 2023 Ferran Recio <[email protected]> | ||
* @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 { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* @package core_courseformat | ||
* @copyright 2023 Ferran Recio <[email protected]> | ||
* @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 { | ||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
* @package core_courseformat | ||
* @copyright 2024 Ferran Recio <[email protected]> | ||
* @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 { | ||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
* @package core_courseformat | ||
* @copyright 2023 Ferran Recio <[email protected]> | ||
* @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 { | ||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
* @subpackage course | ||
* @copyright 2021 Tomo Tsuyuki <[email protected]> | ||
* @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 @@ public function test_delete_module_execution(): void { | |
|
||
/** | ||
* Test with failed and successful cms | ||
* | ||
* @covers ::course_delete_modules | ||
*/ | ||
public function test_delete_module_exception(): void { | ||
global $DB; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,13 +30,13 @@ | |
* @copyright 2023 Kevin Percy <[email protected]> | ||
* @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 @@ public function get_feedback_provider(): array { | |
/** | ||
* 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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
* @copyright 2019 Victor Deniz <[email protected]> | ||
* @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 @@ public function test_removeContentFile(): void { | |
|
||
/** | ||
* 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 @@ public function test_generate_custom_styles(): void { | |
|
||
/** | ||
* Test H5P custom styles retrieval. | ||
* | ||
* @covers ::get_custom_styles | ||
*/ | ||
public function test_get_custom_styles(): void { | ||
global $CFG; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.