Skip to content

Commit

Permalink
undeclared class variables were throwing errors with PHP 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed Apr 28, 2024
1 parent add1c8f commit e62bede
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
8 changes: 8 additions & 0 deletions question.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ class qtype_gapfill_question extends question_graded_automatically_with_countbac
*/
public $answer;

/**
* Only used for testing
*
* @var $gapstofill int
*/

public $gapstofill;

/**
* Display draggables after the body of the question
* @var boolean
Expand Down
7 changes: 6 additions & 1 deletion tests/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,18 @@
*/
class qtype_gapfill_test_helper extends question_test_helper {

/**
* @var int $gapstofill
*/
public $gapstofill;

/**
* must be implemented or class made abstract
*
* @return string
*/
public function get_test_questions() {
return array('catmat');
return ['catmat'];
}

/**
Expand Down
10 changes: 10 additions & 0 deletions tests/question_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@
* @coversDefaultClass \question\type\gapfill\question
*/
class question_test extends \advanced_testcase {

/**
*
* @var qtype_gapfill $gapfill
* An instance of the question type
*/
public $qtype;


/**
* Test value returned by questionid_column_name()
*
Expand Down Expand Up @@ -255,6 +264,7 @@ public function test_is_same_response() {
}
public function setUp(): void {
$this->qtype = \question_bank::get_qtype('gapfill');

}

protected function tearDown(): void {
Expand Down

0 comments on commit e62bede

Please sign in to comment.