Línea 74... |
Línea 74... |
74 |
/**
|
74 |
/**
|
75 |
* Test if creating a question a new version and bank entry records are created.
|
75 |
* Test if creating a question a new version and bank entry records are created.
|
76 |
*
|
76 |
*
|
77 |
* @covers ::load_question
|
77 |
* @covers ::load_question
|
78 |
*/
|
78 |
*/
|
79 |
public function test_make_question_create_version_and_bank_entry() {
|
79 |
public function test_make_question_create_version_and_bank_entry(): void {
|
80 |
global $DB;
|
80 |
global $DB;
|
Línea 81... |
Línea 81... |
81 |
|
81 |
|
82 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
82 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
Línea 109... |
Línea 109... |
109 |
* Test if deleting a question the related version and bank entry records are deleted.
|
109 |
* Test if deleting a question the related version and bank entry records are deleted.
|
110 |
*
|
110 |
*
|
111 |
* @covers ::load_question
|
111 |
* @covers ::load_question
|
112 |
* @covers ::question_delete_question
|
112 |
* @covers ::question_delete_question
|
113 |
*/
|
113 |
*/
|
114 |
public function test_delete_question_delete_versions() {
|
114 |
public function test_delete_question_delete_versions(): void {
|
115 |
global $DB;
|
115 |
global $DB;
|
Línea 116... |
Línea 116... |
116 |
|
116 |
|
117 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
117 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
118 |
$question = $this->qgenerator->create_question('shortanswer', null, ['category' => $qcategory->id]);
|
118 |
$question = $this->qgenerator->create_question('shortanswer', null, ['category' => $qcategory->id]);
|
Línea 162... |
Línea 162... |
162 |
*
|
162 |
*
|
163 |
* @covers ::load_question
|
163 |
* @covers ::load_question
|
164 |
* @covers ::quiz_add_quiz_question
|
164 |
* @covers ::quiz_add_quiz_question
|
165 |
* @covers ::question_delete_question
|
165 |
* @covers ::question_delete_question
|
166 |
*/
|
166 |
*/
|
167 |
public function test_delete_question_in_use() {
|
167 |
public function test_delete_question_in_use(): void {
|
168 |
global $DB;
|
168 |
global $DB;
|
Línea 169... |
Línea 169... |
169 |
|
169 |
|
170 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
170 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
171 |
$question = $this->qgenerator->create_question('shortanswer', null, ['category' => $qcategory->id]);
|
171 |
$question = $this->qgenerator->create_question('shortanswer', null, ['category' => $qcategory->id]);
|
Línea 195... |
Línea 195... |
195 |
* Test if moving a category will not break a quiz.
|
195 |
* Test if moving a category will not break a quiz.
|
196 |
*
|
196 |
*
|
197 |
* @covers ::load_question
|
197 |
* @covers ::load_question
|
198 |
* @covers ::quiz_add_quiz_question
|
198 |
* @covers ::quiz_add_quiz_question
|
199 |
*/
|
199 |
*/
|
200 |
public function test_move_category_with_questions() {
|
200 |
public function test_move_category_with_questions(): void {
|
201 |
global $DB;
|
201 |
global $DB;
|
Línea 202... |
Línea 202... |
202 |
|
202 |
|
203 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
203 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
204 |
$qcategorychild = $this->qgenerator->create_question_category(['contextid' => $this->context->id,
|
204 |
$qcategorychild = $this->qgenerator->create_question_category(['contextid' => $this->context->id,
|
Línea 230... |
Línea 230... |
230 |
/**
|
230 |
/**
|
231 |
* Test that all versions will have the same bank entry idnumber value.
|
231 |
* Test that all versions will have the same bank entry idnumber value.
|
232 |
*
|
232 |
*
|
233 |
* @covers ::load_question
|
233 |
* @covers ::load_question
|
234 |
*/
|
234 |
*/
|
235 |
public function test_id_number_in_bank_entry() {
|
235 |
public function test_id_number_in_bank_entry(): void {
|
236 |
global $DB;
|
236 |
global $DB;
|
Línea 237... |
Línea 237... |
237 |
|
237 |
|
238 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
238 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
239 |
$question = $this->qgenerator->create_question('shortanswer', null,
|
239 |
$question = $this->qgenerator->create_question('shortanswer', null,
|
Línea 269... |
Línea 269... |
269 |
/**
|
269 |
/**
|
270 |
* Test that all the versions are available from the method.
|
270 |
* Test that all the versions are available from the method.
|
271 |
*
|
271 |
*
|
272 |
* @covers ::get_all_versions_of_question
|
272 |
* @covers ::get_all_versions_of_question
|
273 |
*/
|
273 |
*/
|
274 |
public function test_get_all_versions_of_question() {
|
274 |
public function test_get_all_versions_of_question(): void {
|
275 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
275 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
276 |
$question = $this->qgenerator->create_question('shortanswer', null,
|
276 |
$question = $this->qgenerator->create_question('shortanswer', null,
|
277 |
[
|
277 |
[
|
278 |
'category' => $qcategory->id,
|
278 |
'category' => $qcategory->id,
|
279 |
'idnumber' => 'id1'
|
279 |
'idnumber' => 'id1'
|
Línea 298... |
Línea 298... |
298 |
/**
|
298 |
/**
|
299 |
* Test that all the versions of questions are available from the method.
|
299 |
* Test that all the versions of questions are available from the method.
|
300 |
*
|
300 |
*
|
301 |
* @covers ::get_all_versions_of_questions
|
301 |
* @covers ::get_all_versions_of_questions
|
302 |
*/
|
302 |
*/
|
303 |
public function test_get_all_versions_of_questions() {
|
303 |
public function test_get_all_versions_of_questions(): void {
|
304 |
global $DB;
|
304 |
global $DB;
|
Línea 305... |
Línea 305... |
305 |
|
305 |
|
306 |
$questionversions = [];
|
306 |
$questionversions = [];
|
307 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
307 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
Línea 335... |
Línea 335... |
335 |
* all pending definitions have their latestversion field populated at once.
|
335 |
* all pending definitions have their latestversion field populated at once.
|
336 |
*
|
336 |
*
|
337 |
* @covers \core_question\output\question_version_info::populate_latest_versions()
|
337 |
* @covers \core_question\output\question_version_info::populate_latest_versions()
|
338 |
* @return void
|
338 |
* @return void
|
339 |
*/
|
339 |
*/
|
340 |
public function test_populate_definition_latestversions() {
|
340 |
public function test_populate_definition_latestversions(): void {
|
341 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
341 |
$qcategory = $this->qgenerator->create_question_category(['contextid' => $this->context->id]);
|
342 |
$question1 = $this->qgenerator->create_question('shortanswer', null, ['category' => $qcategory->id]);
|
342 |
$question1 = $this->qgenerator->create_question('shortanswer', null, ['category' => $qcategory->id]);
|
343 |
$question2 = $this->qgenerator->create_question('shortanswer', null, ['category' => $qcategory->id]);
|
343 |
$question2 = $this->qgenerator->create_question('shortanswer', null, ['category' => $qcategory->id]);
|
344 |
$question3 = $this->qgenerator->update_question($question2, null, ['idnumber' => 'id2']);
|
344 |
$question3 = $this->qgenerator->update_question($question2, null, ['idnumber' => 'id2']);
|