MDL-81522 phpunit: Add missing void return type to all tests
While this change is not 100% required now, it's good habit and we are checking for it since Moodle 4.4. All the changes in this commit have been applied automatically using the moodle.PHPUnit.TestReturnType sniff and are, exclusively adding the ": void" return types when missing.
This commit is contained in:
@@ -98,7 +98,7 @@ class completionlib_test extends advanced_testcase {
|
||||
* @covers ::is_enabled_for_site
|
||||
* @covers ::is_enabled
|
||||
*/
|
||||
public function test_is_enabled() {
|
||||
public function test_is_enabled(): void {
|
||||
global $CFG;
|
||||
$this->mock_setup();
|
||||
|
||||
@@ -136,7 +136,7 @@ class completionlib_test extends advanced_testcase {
|
||||
/**
|
||||
* @covers ::update_state
|
||||
*/
|
||||
public function test_update_state() {
|
||||
public function test_update_state(): void {
|
||||
$this->mock_setup();
|
||||
|
||||
$mockbuilder = $this->getMockBuilder('completion_info');
|
||||
@@ -361,7 +361,7 @@ class completionlib_test extends advanced_testcase {
|
||||
* @param int $expectedstate
|
||||
* @covers ::internal_get_state
|
||||
*/
|
||||
public function test_internal_get_state(int $completionview, int $completionusegrade, string $unsetfield, int $expectedstate) {
|
||||
public function test_internal_get_state(int $completionview, int $completionusegrade, string $unsetfield, int $expectedstate): void {
|
||||
$this->setup_data();
|
||||
|
||||
/** @var \mod_assign_generator $assigngenerator */
|
||||
@@ -446,7 +446,7 @@ class completionlib_test extends advanced_testcase {
|
||||
* @param int $expectedstate Expected completion state
|
||||
* @covers ::internal_get_state
|
||||
*/
|
||||
public function test_internal_get_state_with_grade_criteria(array $completioncriteria, ?int $studentgrade, int $expectedstate) {
|
||||
public function test_internal_get_state_with_grade_criteria(array $completioncriteria, ?int $studentgrade, int $expectedstate): void {
|
||||
$this->setup_data();
|
||||
|
||||
/** @var \mod_assign_generator $assigngenerator */
|
||||
@@ -488,7 +488,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers ::internal_get_state
|
||||
*/
|
||||
public function test_internal_get_state_with_different_user() {
|
||||
public function test_internal_get_state_with_different_user(): void {
|
||||
$this->setup_data();
|
||||
|
||||
/** @var \mod_assign_generator $assigngenerator */
|
||||
@@ -532,7 +532,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers ::internal_get_state
|
||||
*/
|
||||
public function test_internal_get_state_with_custom_completion() {
|
||||
public function test_internal_get_state_with_custom_completion(): void {
|
||||
$this->setup_data();
|
||||
|
||||
$choicerecord = [
|
||||
@@ -560,7 +560,7 @@ class completionlib_test extends advanced_testcase {
|
||||
/**
|
||||
* @covers ::set_module_viewed
|
||||
*/
|
||||
public function test_set_module_viewed() {
|
||||
public function test_set_module_viewed(): void {
|
||||
$this->mock_setup();
|
||||
|
||||
$mockbuilder = $this->getMockBuilder('completion_info');
|
||||
@@ -618,7 +618,7 @@ class completionlib_test extends advanced_testcase {
|
||||
/**
|
||||
* @covers ::count_user_data
|
||||
*/
|
||||
public function test_count_user_data() {
|
||||
public function test_count_user_data(): void {
|
||||
global $DB;
|
||||
$this->mock_setup();
|
||||
|
||||
@@ -637,7 +637,7 @@ class completionlib_test extends advanced_testcase {
|
||||
/**
|
||||
* @covers ::delete_all_state
|
||||
*/
|
||||
public function test_delete_all_state() {
|
||||
public function test_delete_all_state(): void {
|
||||
global $DB;
|
||||
$this->mock_setup();
|
||||
|
||||
@@ -657,7 +657,7 @@ class completionlib_test extends advanced_testcase {
|
||||
/**
|
||||
* @covers ::reset_all_state
|
||||
*/
|
||||
public function test_reset_all_state() {
|
||||
public function test_reset_all_state(): void {
|
||||
global $DB;
|
||||
$this->mock_setup();
|
||||
|
||||
@@ -734,7 +734,7 @@ class completionlib_test extends advanced_testcase {
|
||||
* @param int $completion The completion state expected.
|
||||
* @covers ::get_data
|
||||
*/
|
||||
public function test_get_data(bool $wholecourse, bool $sameuser, bool $hasrecord, int $completion) {
|
||||
public function test_get_data(bool $wholecourse, bool $sameuser, bool $hasrecord, int $completion): void {
|
||||
global $DB;
|
||||
|
||||
$this->setup_data();
|
||||
@@ -875,7 +875,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers ::get_completion_data
|
||||
*/
|
||||
public function test_get_completion_data() {
|
||||
public function test_get_completion_data(): void {
|
||||
$this->setup_data();
|
||||
$choicegenerator = $this->getDataGenerator()->get_plugin_generator('mod_choice');
|
||||
$choice = $choicegenerator->create_instance([
|
||||
@@ -928,7 +928,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers ::get_other_cm_completion_data
|
||||
*/
|
||||
public function test_get_other_cm_completion_data() {
|
||||
public function test_get_other_cm_completion_data(): void {
|
||||
global $DB;
|
||||
|
||||
$this->setup_data();
|
||||
@@ -1002,7 +1002,7 @@ class completionlib_test extends advanced_testcase {
|
||||
/**
|
||||
* @covers ::internal_set_data
|
||||
*/
|
||||
public function test_internal_set_data() {
|
||||
public function test_internal_set_data(): void {
|
||||
global $DB;
|
||||
$this->setup_data();
|
||||
|
||||
@@ -1112,7 +1112,7 @@ class completionlib_test extends advanced_testcase {
|
||||
/**
|
||||
* @covers ::get_progress_all
|
||||
*/
|
||||
public function test_get_progress_all_few() {
|
||||
public function test_get_progress_all_few(): void {
|
||||
global $DB;
|
||||
$this->mock_setup();
|
||||
|
||||
@@ -1149,7 +1149,7 @@ class completionlib_test extends advanced_testcase {
|
||||
/**
|
||||
* @covers ::get_progress_all
|
||||
*/
|
||||
public function test_get_progress_all_lots() {
|
||||
public function test_get_progress_all_lots(): void {
|
||||
global $DB;
|
||||
$this->mock_setup();
|
||||
|
||||
@@ -1207,7 +1207,7 @@ class completionlib_test extends advanced_testcase {
|
||||
/**
|
||||
* @covers ::inform_grade_changed
|
||||
*/
|
||||
public function test_inform_grade_changed() {
|
||||
public function test_inform_grade_changed(): void {
|
||||
$this->mock_setup();
|
||||
|
||||
$mockbuilder = $this->getMockBuilder('completion_info');
|
||||
@@ -1278,7 +1278,7 @@ class completionlib_test extends advanced_testcase {
|
||||
/**
|
||||
* @covers ::internal_get_grade_state
|
||||
*/
|
||||
public function test_internal_get_grade_state() {
|
||||
public function test_internal_get_grade_state(): void {
|
||||
$this->mock_setup();
|
||||
|
||||
$item = new stdClass;
|
||||
@@ -1347,7 +1347,7 @@ class completionlib_test extends advanced_testcase {
|
||||
/**
|
||||
* @test ::get_activities
|
||||
*/
|
||||
public function test_get_activities() {
|
||||
public function test_get_activities(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -1391,7 +1391,7 @@ class completionlib_test extends advanced_testcase {
|
||||
/**
|
||||
* @test ::has_activities
|
||||
*/
|
||||
public function test_has_activities() {
|
||||
public function test_has_activities(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -1419,7 +1419,7 @@ class completionlib_test extends advanced_testcase {
|
||||
* @covers ::delete_course_completion_data
|
||||
* @covers ::delete_all_completion_data
|
||||
*/
|
||||
public function test_course_delete_prerequisite() {
|
||||
public function test_course_delete_prerequisite(): void {
|
||||
global $DB;
|
||||
|
||||
$this->setup_data();
|
||||
@@ -1457,7 +1457,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers \core\event\course_module_completion_updated
|
||||
*/
|
||||
public function test_course_module_completion_updated_event() {
|
||||
public function test_course_module_completion_updated_event(): void {
|
||||
global $USER, $CFG;
|
||||
|
||||
$this->setup_data();
|
||||
@@ -1495,7 +1495,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers \core\event\course_completed
|
||||
*/
|
||||
public function test_course_completed_event() {
|
||||
public function test_course_completed_event(): void {
|
||||
global $USER;
|
||||
|
||||
$this->setup_data();
|
||||
@@ -1524,7 +1524,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers \core\event\course_completed
|
||||
*/
|
||||
public function test_course_completed_message() {
|
||||
public function test_course_completed_message(): void {
|
||||
$this->setup_data();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -1552,7 +1552,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers \core\event\course_completion_updated
|
||||
*/
|
||||
public function test_course_completion_updated_event() {
|
||||
public function test_course_completion_updated_event(): void {
|
||||
$this->setup_data();
|
||||
$coursecontext = context_course::instance($this->course->id);
|
||||
$coursecompletionevent = \core\event\course_completion_updated::create(
|
||||
@@ -1578,7 +1578,7 @@ class completionlib_test extends advanced_testcase {
|
||||
/**
|
||||
* @covers \completion_can_view_data
|
||||
*/
|
||||
public function test_completion_can_view_data() {
|
||||
public function test_completion_can_view_data(): void {
|
||||
$this->setup_data();
|
||||
|
||||
$student = $this->getDataGenerator()->create_user();
|
||||
@@ -1616,7 +1616,7 @@ class completionlib_test extends advanced_testcase {
|
||||
* @covers ::get_grade_completion
|
||||
*/
|
||||
public function test_get_grade_completion(bool $completionusegrade, bool $hasgrade, ?int $passinggrade,
|
||||
?string $expectedexception, ?int $expectedresult) {
|
||||
?string $expectedexception, ?int $expectedresult): void {
|
||||
$this->setup_data();
|
||||
|
||||
/** @var \mod_assign_generator $assigngenerator */
|
||||
@@ -1649,7 +1649,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers ::get_grade_completion
|
||||
*/
|
||||
public function test_get_grade_completion_without_grade_item() {
|
||||
public function test_get_grade_completion_without_grade_item(): void {
|
||||
global $DB;
|
||||
|
||||
$this->setup_data();
|
||||
@@ -1689,7 +1689,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers \aggregate_completions
|
||||
*/
|
||||
public function test_aggregate_completions() {
|
||||
public function test_aggregate_completions(): void {
|
||||
global $DB, $CFG;
|
||||
require_once($CFG->dirroot.'/completion/criteria/completion_criteria_activity.php');
|
||||
$this->resetAfterTest(true);
|
||||
@@ -1786,7 +1786,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers \completion_completion::_save
|
||||
*/
|
||||
public function test_save() {
|
||||
public function test_save(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -1830,7 +1830,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers \completion_completion::mark_enrolled
|
||||
*/
|
||||
public function test_mark_enrolled() {
|
||||
public function test_mark_enrolled(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -1873,7 +1873,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers \completion_completion::mark_inprogress
|
||||
*/
|
||||
public function test_mark_inprogress() {
|
||||
public function test_mark_inprogress(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -1916,7 +1916,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers \completion_completion::mark_complete
|
||||
*/
|
||||
public function test_mark_complete() {
|
||||
public function test_mark_complete(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -1958,7 +1958,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers \completion_criteria_completion::mark_complete
|
||||
*/
|
||||
public function test_criteria_mark_complete() {
|
||||
public function test_criteria_mark_complete(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -1996,7 +1996,7 @@ class completionlib_test extends advanced_testcase {
|
||||
*
|
||||
* @covers ::delete_all_completion_data
|
||||
*/
|
||||
public function test_course_reset_completion() {
|
||||
public function test_course_reset_completion(): void {
|
||||
global $DB;
|
||||
|
||||
$this->setup_data();
|
||||
|
||||
Reference in New Issue
Block a user