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).
This commit is contained in:
Eloy Lafuente (stronk7)
2024-06-11 11:55:08 +02:00
parent 4f7631113c
commit 6c35a65e1a
3 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -209,7 +209,7 @@ class file_storage_test extends \advanced_testcase {
*
* @covers ::get_file
*/
public function test_get_file() {
public function test_get_file(): stored_file {
global $CFG;
$this->resetAfterTest(false);
+2 -2
View File
@@ -422,7 +422,7 @@ class advanced_test extends \advanced_testcase {
$this->assertEquals(count($processors1) + 1, count($processors3));
}
public function test_message_redirection() {
public function test_message_redirection(): \phpunit_message_sink {
$this->preventResetByRollback(); // Messaging is not compatible with transactions...
$this->resetAfterTest(false);
@@ -544,7 +544,7 @@ class advanced_test extends \advanced_testcase {
/**
* @depends test_message_redirection
*/
public function test_message_redirection_noreset($sink): void {
public function test_message_redirection_noreset(\phpunit_message_sink $sink): void {
if ($this->isInIsolation()) {
$this->markTestSkipped('State cannot be carried over between tests in isolated tests');
}
+3 -3
View File
@@ -358,7 +358,7 @@ class navigationlib_test extends \advanced_testcase {
$this->assertFalse($node->exposed_module_extends_navigation('test1'));
}
public function test_navbar_prepend_and_add() {
public function test_navbar_prepend_and_add(): \moodle_page {
global $PAGE;
// Unfortunate hack needed because people use global $PAGE around the place.
$PAGE->set_url('/');
@@ -452,7 +452,7 @@ class navigationlib_test extends \advanced_testcase {
$this->assertEquals($cache->software, 'Moodle');
}
public function test_setting___construct() {
public function test_setting___construct(): settings_navigation {
global $PAGE, $SITE;
$this->resetAfterTest(false);
@@ -470,7 +470,7 @@ class navigationlib_test extends \advanced_testcase {
* @param mixed $node
* @return mixed
*/
public function test_setting__initialise($node) {
public function test_setting__initialise($node): settings_navigation {
$this->resetAfterTest(false);
$node->initialise();