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:
@@ -95,7 +95,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
);
|
||||
}
|
||||
|
||||
public function test_initial_state() {
|
||||
public function test_initial_state(): void {
|
||||
$this->assertFalse($this->observer->get_modified());
|
||||
$this->assertEquals(0, count($this->observer->get_attempts_added()));
|
||||
$this->assertEquals(0, count($this->observer->get_attempts_modified()));
|
||||
@@ -106,14 +106,14 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_update_usage() {
|
||||
public function test_update_usage(): void {
|
||||
|
||||
$this->quba->set_preferred_behaviour('deferredfeedback');
|
||||
|
||||
$this->assertTrue($this->observer->get_modified());
|
||||
}
|
||||
|
||||
public function test_add_question() {
|
||||
public function test_add_question(): void {
|
||||
|
||||
$slot = $this->quba->add_question(\test_question_maker::make_question('truefalse'));
|
||||
|
||||
@@ -126,7 +126,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_add_and_start_question() {
|
||||
public function test_add_and_start_question(): void {
|
||||
|
||||
$slot = $this->quba->add_question(\test_question_maker::make_question('truefalse'));
|
||||
$this->quba->start_question($slot);
|
||||
@@ -145,7 +145,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_process_action() {
|
||||
public function test_process_action(): void {
|
||||
|
||||
$this->quba->manual_grade($this->slot, 'Actually, that is not quite right', 0.5, FORMAT_HTML);
|
||||
|
||||
@@ -169,7 +169,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_regrade_same_steps() {
|
||||
public function test_regrade_same_steps(): void {
|
||||
|
||||
// Change the question in a minor way and regrade.
|
||||
$this->quba->get_question($this->slot, false)->answers[14]->fraction = 0.5;
|
||||
@@ -199,7 +199,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_regrade_losing_steps() {
|
||||
public function test_regrade_losing_steps(): void {
|
||||
|
||||
// Change the question so that 'toad' is also right, and regrade. This
|
||||
// will mean that the try again, and second try states are no longer
|
||||
@@ -238,7 +238,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_tricky_regrade() {
|
||||
public function test_tricky_regrade(): void {
|
||||
|
||||
// The tricky thing here is that we take a half-complete question-attempt,
|
||||
// and then as one transaction, we submit some more responses, and then
|
||||
@@ -279,7 +279,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_move_question() {
|
||||
public function test_move_question(): void {
|
||||
|
||||
$q = \test_question_maker::make_question('truefalse');
|
||||
$newslot = $this->quba->add_question_in_place_of_other($this->slot, $q);
|
||||
@@ -303,7 +303,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_move_question_then_modify() {
|
||||
public function test_move_question_then_modify(): void {
|
||||
|
||||
$q = \test_question_maker::make_question('truefalse');
|
||||
$newslot = $this->quba->add_question_in_place_of_other($this->slot, $q);
|
||||
@@ -333,7 +333,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_move_question_then_move_again() {
|
||||
public function test_move_question_then_move_again(): void {
|
||||
$originalqa = $this->quba->get_question_attempt($this->slot);
|
||||
|
||||
$q1 = \test_question_maker::make_question('truefalse');
|
||||
@@ -360,7 +360,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_set_max_mark() {
|
||||
public function test_set_max_mark(): void {
|
||||
$this->quba->set_max_mark($this->slot, 6.0);
|
||||
$this->assertEqualsWithDelta(4.0, $this->quba->get_total_mark(), 0.0000005);
|
||||
|
||||
@@ -379,7 +379,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_set_question_attempt_metadata() {
|
||||
public function test_set_question_attempt_metadata(): void {
|
||||
$this->quba->set_question_attempt_metadata($this->slot, 'metathingy', 'a value');
|
||||
$this->assertEquals('a value', $this->quba->get_question_attempt_metadata($this->slot, 'metathingy'));
|
||||
|
||||
@@ -395,7 +395,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_set_question_attempt_metadata_then_change() {
|
||||
public function test_set_question_attempt_metadata_then_change(): void {
|
||||
$this->quba->set_question_attempt_metadata($this->slot, 'metathingy', 'a value');
|
||||
$this->quba->set_question_attempt_metadata($this->slot, 'metathingy', 'different value');
|
||||
$this->assertEquals('different value', $this->quba->get_question_attempt_metadata($this->slot, 'metathingy'));
|
||||
@@ -412,7 +412,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_set_metadata_previously_set_but_dont_actually_change() {
|
||||
public function test_set_metadata_previously_set_but_dont_actually_change(): void {
|
||||
$this->quba->set_question_attempt_metadata($this->slot, 'metathingy', 'a value');
|
||||
$this->observer = new testable_question_engine_unit_of_work($this->quba);
|
||||
$this->quba->set_observer($this->observer);
|
||||
@@ -430,7 +430,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_set_metadata_previously_set() {
|
||||
public function test_set_metadata_previously_set(): void {
|
||||
$this->quba->set_question_attempt_metadata($this->slot, 'metathingy', 'a value');
|
||||
$this->observer = new testable_question_engine_unit_of_work($this->quba);
|
||||
$this->quba->set_observer($this->observer);
|
||||
@@ -449,7 +449,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->observer->get_metadata_modified());
|
||||
}
|
||||
|
||||
public function test_set_metadata_in_new_question() {
|
||||
public function test_set_metadata_in_new_question(): void {
|
||||
$newslot = $this->quba->add_question(\test_question_maker::make_question('truefalse'));
|
||||
$this->quba->start_question($newslot);
|
||||
$this->quba->set_question_attempt_metadata($newslot, 'metathingy', 'a value');
|
||||
@@ -467,7 +467,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_set_metadata_then_move() {
|
||||
public function test_set_metadata_then_move(): void {
|
||||
$this->quba->set_question_attempt_metadata($this->slot, 'metathingy', 'a value');
|
||||
$q = \test_question_maker::make_question('truefalse');
|
||||
$newslot = $this->quba->add_question_in_place_of_other($this->slot, $q);
|
||||
@@ -488,7 +488,7 @@ class unitofwork_test extends \data_loading_method_test_base {
|
||||
$this->assertEquals(0, count($this->observer->get_metadata_modified()));
|
||||
}
|
||||
|
||||
public function test_move_then_set_metadata() {
|
||||
public function test_move_then_set_metadata(): void {
|
||||
$q = \test_question_maker::make_question('truefalse');
|
||||
$newslot = $this->quba->add_question_in_place_of_other($this->slot, $q);
|
||||
$this->quba->start_question($this->slot);
|
||||
|
||||
Reference in New Issue
Block a user