From 5327284debfeca3bb9616d3716606d3673863a64 Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Fri, 9 Apr 2021 15:30:32 +0200 Subject: [PATCH] MDL-71251 qtype_essay: Return new min/max word limit settings via WS Those settings are required by external clients such as the Moodle App --- question/type/essay/question.php | 2 ++ question/type/essay/tests/question_test.php | 3 +++ 2 files changed, 5 insertions(+) diff --git a/question/type/essay/question.php b/question/type/essay/question.php index 5afc2622602..9d331f67b93 100644 --- a/question/type/essay/question.php +++ b/question/type/essay/question.php @@ -247,6 +247,8 @@ class qtype_essay_question extends question_with_responses { 'filetypeslist' => $this->filetypeslist, 'responsetemplate' => $this->responsetemplate, 'responsetemplateformat' => $this->responsetemplateformat, + 'minwordlimit' => $this->minwordlimit, + 'maxwordlimit' => $this->maxwordlimit, ]; return $settings; diff --git a/question/type/essay/tests/question_test.php b/question/type/essay/tests/question_test.php index ee9d932d9ab..363c9b0a6f5 100644 --- a/question/type/essay/tests/question_test.php +++ b/question/type/essay/tests/question_test.php @@ -307,6 +307,7 @@ class qtype_essay_question_test extends advanced_testcase { $this->resetAfterTest(); $essay = test_question_maker::make_an_essay_question(); + $essay->minwordlimit = 15; $essay->start_attempt(new question_attempt_step(), 1); $qa = test_question_maker::get_a_qa($essay); $displayoptions = new question_display_options(); @@ -322,6 +323,8 @@ class qtype_essay_question_test extends advanced_testcase { $this->assertNull($options['filetypeslist']); $this->assertEquals('', $options['responsetemplate']); $this->assertEquals(FORMAT_MOODLE, $options['responsetemplateformat']); + $this->assertEquals($essay->minwordlimit, $options['minwordlimit']); + $this->assertNull($options['maxwordlimit']); } /**