Skip to content

Commit

Permalink
test: set $question->behaviour in question_test
Browse files Browse the repository at this point in the history
  • Loading branch information
MHajoha authored and janbritz committed Nov 7, 2024
1 parent eeecfee commit 513fedc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/question_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

namespace qtype_questionpy;

use coding_exception;
use moodle_exception;
use qbehaviour_questionpy;
use qtype_questionpy\api\api;
use qtype_questionpy\api\package_api;
use qtype_questionpy\event\grading_response_failed;
Expand All @@ -25,6 +27,7 @@
use qtype_questionpy_question;
use question_attempt;
use question_bank;
use question_engine;
use question_state;
use Throwable;

Expand Down Expand Up @@ -68,14 +71,18 @@ protected function setUp(): void {
* Create a QuestionPy question.
*
* @return qtype_questionpy_question
* @throws coding_exception
*/
private function create_question(): qtype_questionpy_question {
return new qtype_questionpy_question(
question_engine::load_behaviour_class("questionpy");
$question = new qtype_questionpy_question(
hash('sha256', 'hash'),
'state',
packagefile: null,
api: $this->api
);
$question->behaviour = $this->createStub(qbehaviour_questionpy::class);
return $question;
}

/**
Expand Down

0 comments on commit 513fedc

Please sign in to comment.