Skip to content

Commit

Permalink
MDL-83472 phpunit: add void return type to test methods.
Browse files Browse the repository at this point in the history
See also 01148a0 from MDL-81522.
  • Loading branch information
paulholden committed Oct 16, 2024
1 parent 01540bb commit 37266a9
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static function availability_levels(): array {
* @param string $availabilitylevel
* @return void
*/
public function test_get_activities_with_availability($availabilitylevel) {
public function test_get_activities_with_availability($availabilitylevel): void {

list($course, $stu1) = $this->setup_course();

Expand Down Expand Up @@ -113,7 +113,7 @@ public function test_get_activities_with_availability($availabilitylevel) {
*
* @return void
*/
public function test_get_activities_with_weeks() {
public function test_get_activities_with_weeks(): void {

$startdate = gmmktime('0', '0', '0', 10, 24, 2015);
$record = array(
Expand Down Expand Up @@ -156,7 +156,7 @@ public function test_get_activities_with_weeks() {
*
* @return void
*/
public function test_get_activities_by_section() {
public function test_get_activities_by_section(): void {

// This makes debugging easier, sorry WA's +8 :).
$this->setTimezone('UTC');
Expand Down Expand Up @@ -226,7 +226,7 @@ public function test_get_activities_by_section() {
*
* @return void
*/
public function test_get_activities_with_specific_restrictions() {
public function test_get_activities_with_specific_restrictions(): void {

list($course, $stu1) = $this->setup_course();

Expand Down
4 changes: 2 additions & 2 deletions lib/tests/event/course_module_instance_list_viewed_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class course_module_instance_list_viewed_test extends advanced_testcase {
/**
* Test event properties and methods.
*/
public function test_event_attributes() {
public function test_event_attributes(): void {

$this->resetAfterTest();
$course = $this->getDataGenerator()->create_course();
Expand All @@ -65,7 +65,7 @@ public function test_event_attributes() {
/**
* Test custom validations of the event.
*/
public function test_event_validations() {
public function test_event_validations(): void {
try {
\mod_unittests\event\course_module_instance_list_viewed::create(array('context' => context_system::instance()));
$this->fail('Event validation should not allow course_module_instance_list_viewed event to be triggered without outside
Expand Down
4 changes: 2 additions & 2 deletions lib/tests/event/course_module_viewed_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class course_module_viewed_test extends advanced_testcase {
/**
* Test event properties and methods.
*/
public function test_event_attributes() {
public function test_event_attributes(): void {

$this->resetAfterTest();
$course = $this->getDataGenerator()->create_course();
Expand Down Expand Up @@ -71,7 +71,7 @@ public function test_event_attributes() {
/**
* Test custom validations of the event.
*/
public function test_event_validations() {
public function test_event_validations(): void {

// Make sure objecttable and object id is always set.
try {
Expand Down
2 changes: 1 addition & 1 deletion mod/glossary/tests/external/delete_entry_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class delete_entry_test extends externallib_advanced_testcase {
/**
* Test the behaviour of delete_entry().
*/
public function test_delete_entry() {
public function test_delete_entry(): void {
global $DB;
$this->resetAfterTest();

Expand Down
2 changes: 1 addition & 1 deletion mod/glossary/tests/external/prepare_entry_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class prepare_entry_test extends externallib_advanced_testcase {
/**
* test_prepare_entry
*/
public function test_prepare_entry() {
public function test_prepare_entry(): void {
global $USER;
$this->resetAfterTest(true);

Expand Down
10 changes: 5 additions & 5 deletions mod/glossary/tests/external/update_entry_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ final class update_entry_test extends externallib_advanced_testcase {
/**
* test_update_entry_without_optional_settings
*/
public function test_update_entry_without_optional_settings() {
public function test_update_entry_without_optional_settings(): void {
global $CFG, $DB;
$this->resetAfterTest(true);

Expand Down Expand Up @@ -78,7 +78,7 @@ public function test_update_entry_without_optional_settings() {
/**
* test_update_entry_duplicated
*/
public function test_update_entry_duplicated() {
public function test_update_entry_duplicated(): void {
global $CFG, $DB;
$this->resetAfterTest(true);

Expand Down Expand Up @@ -115,7 +115,7 @@ public function test_update_entry_duplicated() {
/**
* test_update_entry_with_aliases
*/
public function test_update_entry_with_aliases() {
public function test_update_entry_with_aliases(): void {
global $DB;
$this->resetAfterTest(true);

Expand Down Expand Up @@ -152,7 +152,7 @@ public function test_update_entry_with_aliases() {
/**
* test_update_entry_in_categories
*/
public function test_update_entry_in_categories() {
public function test_update_entry_in_categories(): void {
global $DB;
$this->resetAfterTest(true);

Expand Down Expand Up @@ -193,7 +193,7 @@ public function test_update_entry_in_categories() {
/**
* test_update_entry_with_attachments
*/
public function test_update_entry_with_attachments() {
public function test_update_entry_with_attachments(): void {
global $DB, $USER;
$this->resetAfterTest(true);

Expand Down
16 changes: 8 additions & 8 deletions privacy/tests/userlist_collection_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class userlist_collection_test extends advanced_testcase {
*
* @covers ::add_userlist
*/
public function test_supports_userlist() {
public function test_supports_userlist(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);

Expand All @@ -52,7 +52,7 @@ public function test_supports_userlist() {
*
* @covers ::add_userlist
*/
public function test_supports_approved_userlist() {
public function test_supports_approved_userlist(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);

Expand All @@ -67,7 +67,7 @@ public function test_supports_approved_userlist() {
*
* @covers ::get_userlist_for_component
*/
public function test_get_userlist_for_component() {
public function test_get_userlist_for_component(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);

Expand All @@ -88,7 +88,7 @@ public function test_get_userlist_for_component() {
*
* @covers ::get_userlist_for_component
*/
public function test_get_userlist_for_component_not_found() {
public function test_get_userlist_for_component_not_found(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);

Expand All @@ -100,7 +100,7 @@ public function test_get_userlist_for_component_not_found() {
*
* @covers ::add_userlist
*/
public function test_duplicate_addition_throws() {
public function test_duplicate_addition_throws(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);

Expand All @@ -116,7 +116,7 @@ public function test_duplicate_addition_throws() {
*
* @covers ::count
*/
public function test_countable() {
public function test_countable(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);

Expand All @@ -135,7 +135,7 @@ public function test_countable() {
* @covers ::rewind
* @covers ::valid
*/
public function test_iteration() {
public function test_iteration(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);

Expand Down Expand Up @@ -165,7 +165,7 @@ public function test_iteration() {
*
* @covers ::get_context
*/
public function test_get_context() {
public function test_get_context(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);

Expand Down
4 changes: 2 additions & 2 deletions report/progress/tests/report_progress_helper_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function setUp(): void {
/**
* Test process_activities_by_filter_options function.
*/
public function test_sort_activities() {
public function test_sort_activities(): void {
$expectedactivitytypes = ['all' => 'All activities and resources', 'assign' => 'Assignments', 'quiz' => 'Quizzes'];

// Generate test data.
Expand All @@ -76,7 +76,7 @@ public function test_sort_activities() {
/**
* Test filtering by section.
*/
public function test_filter_activities_by_section() {
public function test_filter_activities_by_section(): void {
$course = $this->getDataGenerator()->create_course(array('enablecompletion' => 1));
$this->generator->create_module('quiz', ['course' => $course->id, 'name' => 'Quiz 2', 'section' => 1],
['completion' => 1]);
Expand Down

0 comments on commit 37266a9

Please sign in to comment.