mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 10:56:56 +02:00
MDL-67673 phpunit: Fix the return type of template methods
All the setup/teardown/pre/post/conditions template methods now are required to return void. This was warned with phpunit 7 and now is enforced. At the same time, fix a few wrong function names, provider data and param types, return statements...
This commit is contained in:
parent
c611109ed7
commit
d81a94807b
421 changed files with 531 additions and 531 deletions
|
@ -796,7 +796,7 @@ abstract class qbehaviour_walkthrough_test_base extends question_testcase {
|
|||
*/
|
||||
protected $currentoutput = '';
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
|
@ -805,7 +805,7 @@ abstract class qbehaviour_walkthrough_test_base extends question_testcase {
|
|||
context_system::instance());
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
$this->displayoptions = null;
|
||||
$this->quba = null;
|
||||
parent::tearDown();
|
||||
|
|
|
@ -50,14 +50,14 @@ class question_attempt_testcase extends advanced_testcase {
|
|||
/** @var question_attempt a question attempt that can be used in the tests. */
|
||||
private $qa;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->question = test_question_maker::make_question('description');
|
||||
$this->question->defaultmark = 3;
|
||||
$this->usageid = 13;
|
||||
$this->qa = new question_attempt($this->question, $this->usageid);
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
$this->question = null;
|
||||
$this->useageid = null;
|
||||
$this->qa = null;
|
||||
|
|
|
@ -44,7 +44,7 @@ class question_attempt_with_steps_test extends advanced_testcase {
|
|||
private $question;
|
||||
private $qa;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->question = test_question_maker::make_question('description');
|
||||
$this->qa = new testable_question_attempt($this->question, 0, null, 2);
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
|
@ -53,7 +53,7 @@ class question_attempt_with_steps_test extends advanced_testcase {
|
|||
}
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
$this->qa = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class question_attempt_iterator_test extends advanced_testcase {
|
|||
private $qas = array();
|
||||
private $iterator;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->quba = question_engine::make_questions_usage_by_activity('unit_test',
|
||||
context_system::instance());
|
||||
$this->quba->set_preferred_behaviour('deferredfeedback');
|
||||
|
@ -56,7 +56,7 @@ class question_attempt_iterator_test extends advanced_testcase {
|
|||
$this->iterator = $this->quba->get_attempt_iterator();
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
$this->quba = null;
|
||||
$this->iterator = null;
|
||||
}
|
||||
|
@ -122,4 +122,4 @@ class question_attempt_iterator_test extends advanced_testcase {
|
|||
public function test_cannot_unset() {
|
||||
unset($this->iterator[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class question_attempt_step_iterator_test extends advanced_testcase {
|
|||
private $qa;
|
||||
private $iterator;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$question = test_question_maker::make_question('description');
|
||||
$this->qa = new testable_question_attempt($question, 0);
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
|
@ -51,7 +51,7 @@ class question_attempt_step_iterator_test extends advanced_testcase {
|
|||
$this->iterator = $this->qa->get_step_iterator();
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
$this->qa = null;
|
||||
$this->iterator = null;
|
||||
}
|
||||
|
@ -141,4 +141,4 @@ class question_attempt_step_iterator_test extends advanced_testcase {
|
|||
public function test_cannot_unset() {
|
||||
unset($this->iterator[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -747,7 +747,7 @@ class question_usage_autosave_test extends qbehaviour_walkthrough_test_base {
|
|||
$this->delete_quba();
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
// This test relies on the destructor for the second DB connection being called before running the next test.
|
||||
// Without this change - there will be unit test failures on "some" DBs (MySQL).
|
||||
gc_collect_cycles();
|
||||
|
|
|
@ -47,7 +47,7 @@ class question_engine_unit_of_work_test extends data_loading_method_test_base {
|
|||
/** @var testable_question_engine_unit_of_work the unit of work we are testing. */
|
||||
protected $observer;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
// Create a usage in an initial state, with one shortanswer question added,
|
||||
// and attempted in interactive mode submitted responses 'toad' then 'frog'.
|
||||
// Then set it to use a new unit of work for any subsequent changes.
|
||||
|
@ -64,7 +64,7 @@ class question_engine_unit_of_work_test extends data_loading_method_test_base {
|
|||
$this->setup_initial_test_state($this->get_test_data());
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
question_bank::end_unit_test();
|
||||
}
|
||||
|
||||
|
|
|
@ -97,14 +97,14 @@ abstract class question_attempt_upgrader_test_base extends advanced_testcase {
|
|||
protected $updater;
|
||||
protected $loader;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$logger = new dummy_question_engine_assumption_logger();
|
||||
$this->loader = new test_question_engine_upgrade_question_loader($logger);
|
||||
$this->updater = new test_question_engine_attempt_upgrader($this->loader, $logger);
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
$this->updater = null;
|
||||
parent::tearDown();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue