Skip to content

Commit

Permalink
MDL-77581 lesson: Fix generator unit tests in oracle
Browse files Browse the repository at this point in the history
  • Loading branch information
dpalou committed Nov 14, 2023
1 parent 5bda7ca commit f7ea9dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mod/lesson/tests/generator_test.php
Expand Up @@ -386,7 +386,7 @@ public function test_create_page_and_answers(): void {
$lessongenerator->finish_generate_answer();

// Check that pages and answers have been created.
$pages = $DB->get_records('lesson_pages', ['lessonid' => $lesson->id], 'title DESC');
$pages = $DB->get_records('lesson_pages', ['lessonid' => $lesson->id], $DB->sql_order_by_text('title') . ' DESC');
$this->assertEquals(2, count($pages));

$contentpagedb = array_pop($pages);
Expand All @@ -398,7 +398,7 @@ public function test_create_page_and_answers(): void {
$this->assertEquals($multichoicepage['content'], $multichoicepagedb->contents);
$this->assertEquals(LESSON_PAGE_MULTICHOICE, $multichoicepagedb->qtype);

$answers = $DB->get_records('lesson_answers', ['lessonid' => $lesson->id], 'answer DESC');
$answers = $DB->get_records('lesson_answers', ['lessonid' => $lesson->id], $DB->sql_order_by_text('answer') . ' DESC');
$this->assertEquals(5, count($answers));

$multichoicepagecatanswerdb = array_pop($answers);
Expand Down Expand Up @@ -475,7 +475,7 @@ public function test_create_page_with_previouspage(): void {
// Don't define any answers, the default answers will be added.
$lessongenerator->finish_generate_answer();

$pages = $DB->get_records('lesson_pages', ['lessonid' => $lesson->id], 'title DESC');
$pages = $DB->get_records('lesson_pages', ['lessonid' => $lesson->id], $DB->sql_order_by_text('title') . ' DESC');
$this->assertEquals(3, count($pages));

$firstpagedb = array_pop($pages);
Expand Down Expand Up @@ -657,7 +657,7 @@ public function test_create_answer_jumpto(): void {

$secondcontentpagedb = $DB->get_record('lesson_pages', ['lessonid' => $lesson->id, 'title' => $secondcontentpage['title']]);
$thirdcontentpagedb = $DB->get_record('lesson_pages', ['lessonid' => $lesson->id, 'title' => $thirdcontentpage['title']]);
$answers = $DB->get_records('lesson_answers', ['lessonid' => $lesson->id], 'answer DESC');
$answers = $DB->get_records('lesson_answers', ['lessonid' => $lesson->id], $DB->sql_order_by_text('answer') . ' DESC');
$this->assertEquals(11, count($answers));

$this->assertEquals(LESSON_THISPAGE, array_pop($answers)->jumpto);
Expand Down

0 comments on commit f7ea9dd

Please sign in to comment.