Skip to content

Commit 6c35a65

Browse files
committed
MDL-81522 phpunit: Add a few non-void return types to tests
This is the final (3rd) commit, where we are adding missing return types to a few tests (using @Depends) which return types are non-void, but something really returned (for consume by the dependent test).
1 parent 4f76311 commit 6c35a65

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/filestorage/tests/file_storage_test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public function test_create_file_from_pathname(): void {
209209
*
210210
* @covers ::get_file
211211
*/
212-
public function test_get_file() {
212+
public function test_get_file(): stored_file {
213213
global $CFG;
214214

215215
$this->resetAfterTest(false);

lib/phpunit/tests/advanced_test.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ public function test_message_processors_reset(): void {
422422
$this->assertEquals(count($processors1) + 1, count($processors3));
423423
}
424424

425-
public function test_message_redirection() {
425+
public function test_message_redirection(): \phpunit_message_sink {
426426
$this->preventResetByRollback(); // Messaging is not compatible with transactions...
427427
$this->resetAfterTest(false);
428428

@@ -544,7 +544,7 @@ public function test_message_redirection() {
544544
/**
545545
* @depends test_message_redirection
546546
*/
547-
public function test_message_redirection_noreset($sink): void {
547+
public function test_message_redirection_noreset(\phpunit_message_sink $sink): void {
548548
if ($this->isInIsolation()) {
549549
$this->markTestSkipped('State cannot be carried over between tests in isolated tests');
550550
}

lib/tests/navigationlib_test.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public function test_module_extends_navigation(): void {
358358
$this->assertFalse($node->exposed_module_extends_navigation('test1'));
359359
}
360360

361-
public function test_navbar_prepend_and_add() {
361+
public function test_navbar_prepend_and_add(): \moodle_page {
362362
global $PAGE;
363363
// Unfortunate hack needed because people use global $PAGE around the place.
364364
$PAGE->set_url('/');
@@ -452,7 +452,7 @@ public function test_cache_set(): void {
452452
$this->assertEquals($cache->software, 'Moodle');
453453
}
454454

455-
public function test_setting___construct() {
455+
public function test_setting___construct(): settings_navigation {
456456
global $PAGE, $SITE;
457457

458458
$this->resetAfterTest(false);
@@ -470,7 +470,7 @@ public function test_setting___construct() {
470470
* @param mixed $node
471471
* @return mixed
472472
*/
473-
public function test_setting__initialise($node) {
473+
public function test_setting__initialise($node): settings_navigation {
474474
$this->resetAfterTest(false);
475475

476476
$node->initialise();

0 commit comments

Comments
 (0)