Merge branch 'MDL-85551_main' of https://github.com/marxjohnson/moodle
This commit is contained in:
@@ -433,6 +433,11 @@ function edit_module_post_actions($moduleinfo, $course) {
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin_supports('mod', $moduleinfo->modulename, FEATURE_USES_QUESTIONS) && empty($moduleinfo->skipdefaultcategory)) {
|
||||
// Create the default question category.
|
||||
question_get_default_category($modcontext->id, true);
|
||||
}
|
||||
|
||||
return $moduleinfo;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="lib/db" VERSION="20250822" COMMENT="XMLDB file for core Moodle tables"
|
||||
<XMLDB PATH="lib/db" VERSION="20250902" COMMENT="XMLDB file for core Moodle tables"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@@ -1427,7 +1427,7 @@
|
||||
<TABLE NAME="question_categories" COMMENT="Categories are for grouping questions">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
||||
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="name" TYPE="char" LENGTH="1333" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="context that this category is shared in"/>
|
||||
<FIELD NAME="info" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="infoformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
|
||||
@@ -2082,5 +2082,17 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2025082600.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2025082900.01) {
|
||||
// Changing precision of field name on table question_categories to (1333).
|
||||
$table = new xmldb_table('question_categories');
|
||||
$field = new xmldb_field('name', XMLDB_TYPE_CHAR, '1333', null, XMLDB_NOTNULL, null, null, 'id');
|
||||
|
||||
// Launch change of precision for field name.
|
||||
$dbman->change_field_precision($table, $field);
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2025082900.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1082,8 +1082,8 @@ function question_get_default_category($contextid, bool $createifnotexists = fal
|
||||
// We don't have one, so we need to make one.
|
||||
$defaultcat = new stdClass();
|
||||
$contextname = $context->get_context_name(false, true);
|
||||
// Max length of name field is 255.
|
||||
$defaultcat->name = shorten_text(get_string('defaultfor', 'question', $contextname), 255);
|
||||
// Max length of name field is 1333.
|
||||
$defaultcat->name = shorten_text(get_string('defaultfor', 'question', $contextname), 1333);
|
||||
$defaultcat->info = get_string('defaultinfofor', 'question', $contextname);
|
||||
$defaultcat->contextid = $context->id;
|
||||
$defaultcat->parent = $topcategory->id;
|
||||
|
||||
@@ -171,10 +171,8 @@ final class questionlib_test extends \advanced_testcase {
|
||||
$context2 = \context_module::instance($modqbank2->cmid);
|
||||
/** @var \core_question_generator $questiongenerator */
|
||||
$questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
||||
$questioncat1 = $questiongenerator->create_question_category(['contextid' =>
|
||||
$context1->id]);
|
||||
$questioncat2 = $questiongenerator->create_question_category(['contextid' =>
|
||||
$context2->id]);
|
||||
$questioncat1 = question_get_default_category($context1->id);
|
||||
$questioncat2 = question_get_default_category($context2->id);
|
||||
$question1 = $questiongenerator->create_question('shortanswer', null, ['category' => $questioncat1->id]);
|
||||
$question2 = $questiongenerator->create_question('shortanswer', null, ['category' => $questioncat1->id]);
|
||||
$question3 = $questiongenerator->create_question('shortanswer', null, ['category' => $questioncat2->id]);
|
||||
@@ -209,7 +207,7 @@ final class questionlib_test extends \advanced_testcase {
|
||||
|
||||
// Create some question categories and questions in this course.
|
||||
$modcontext = \context_module::instance($modqbank3->cmid);
|
||||
$questioncat = $questiongenerator->create_question_category(['contextid' => $modcontext->id]);
|
||||
$questioncat = question_get_default_category($modcontext->id);
|
||||
$question1 = $questiongenerator->create_question('shortanswer', null, ['category' => $questioncat->id]);
|
||||
$question2 = $questiongenerator->create_question('shortanswer', null, ['category' => $questioncat->id]);
|
||||
|
||||
@@ -1217,7 +1215,7 @@ final class questionlib_test extends \advanced_testcase {
|
||||
$context = $this->create_course_and_question_bank();
|
||||
|
||||
$top = question_get_top_category($context->id, true);
|
||||
$cat1 = $questiongenerator->create_question_category(['parent' => $top->id]);
|
||||
$cat1 = question_get_default_category($context->id);
|
||||
$sub11 = $questiongenerator->create_question_category(['parent' => $cat1->id]);
|
||||
$sub12 = $questiongenerator->create_question_category(['parent' => $cat1->id]);
|
||||
$cat2 = $questiongenerator->create_question_category(['parent' => $top->id]);
|
||||
@@ -1255,7 +1253,7 @@ final class questionlib_test extends \advanced_testcase {
|
||||
$wrongcontext = \context_module::instance($qbank2->cmid);
|
||||
|
||||
$top = question_get_top_category($bank1context->id, true);
|
||||
$cat1 = $questiongenerator->create_question_category(['parent' => $top->id]);
|
||||
$cat1 = question_get_default_category($bank1context->id);
|
||||
$sub11 = $questiongenerator->create_question_category(['parent' => $cat1->id]);
|
||||
$sub12 = $questiongenerator->create_question_category(['parent' => $cat1->id]);
|
||||
$cat2 = $questiongenerator->create_question_category(['parent' => $top->id, 'contextid' => $wrongcontext->id]);
|
||||
|
||||
@@ -209,6 +209,7 @@ Feature: Regrading quiz attempts using the Grades report
|
||||
And I should see "Overall number of students achieving grade ranges"
|
||||
And "Student One" row "Regrade" column of "attempts" table should not contain "Needed"
|
||||
And I am on the "Quiz for testing regrading" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I choose "Edit question" action for "TF" in the question bank
|
||||
And I set the field "Correct answer" to "False"
|
||||
And I press "id_submitbutton"
|
||||
@@ -239,6 +240,7 @@ Feature: Regrading quiz attempts using the Grades report
|
||||
And I should see "(latest)" in the "TF" "list_item"
|
||||
# Create multiple question versions.
|
||||
And I am on the "Quiz for testing regrading" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I choose "Edit question" action for "TF" in the question bank
|
||||
And I set the field "Correct answer" to "True"
|
||||
And I press "id_submitbutton"
|
||||
@@ -277,6 +279,7 @@ Feature: Regrading quiz attempts using the Grades report
|
||||
And I click on "Yes" "button"
|
||||
# Create multiple question versions.
|
||||
And I am on the "Quiz for testing regrading" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I choose "Delete" action for "SA" in the question bank
|
||||
And I press "Delete"
|
||||
And I am on the "Quiz for testing regrading" "mod_quiz > edit" page
|
||||
@@ -286,6 +289,7 @@ Feature: Regrading quiz attempts using the Grades report
|
||||
And I click on "Yes" "button" in the "Confirm" "dialogue"
|
||||
And I click on "Add" "link"
|
||||
And I follow "a random question"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I press "Add random question"
|
||||
And I am on the "Quiz for testing regrading" "quiz activity" page logged in as student3
|
||||
And I click on "Attempt quiz" "button"
|
||||
@@ -295,6 +299,7 @@ Feature: Regrading quiz attempts using the Grades report
|
||||
And I press "Submit all and finish"
|
||||
And I click on "Submit" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||
And I am on the "Quiz for testing regrading" "mod_quiz > question bank" page logged in as teacher
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I choose "Edit question" action for "TF" in the question bank
|
||||
And I set the field "Correct answer" to "False"
|
||||
And I press "id_submitbutton"
|
||||
|
||||
@@ -197,6 +197,7 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
|
||||
And I follow "a random question"
|
||||
And I click on "Switch bank" "button"
|
||||
And I click on "Qbank 1" "link" in the "Select question bank" "dialogue"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I press "Add random question"
|
||||
And user "student" has started an attempt at quiz "Quiz 2" randomised as follows:
|
||||
| slot | actualquestion |
|
||||
|
||||
@@ -47,6 +47,7 @@ Feature: Adding questions to a quiz from the question bank
|
||||
When I am on the "Quiz 1" "mod_quiz > Edit" page
|
||||
And I open the "last" add to quiz menu
|
||||
And I follow "from question bank"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
Then I should see "foo" in the "question 01 name" "table_row"
|
||||
And I should see "bar" in the "question 02 name" "table_row"
|
||||
And I should see "qidnum" in the "question 02 name" "table_row"
|
||||
@@ -70,6 +71,7 @@ Feature: Adding questions to a quiz from the question bank
|
||||
And I follow "from question bank"
|
||||
And I click on "Switch bank" "button"
|
||||
And I click on "Qbank 1 & < > \" ' &" "link" in the "Select question bank" "dialogue"
|
||||
And I apply question bank filter "Category" with value "Qbank questions"
|
||||
Then I should see "qbanktag1" in the "question 03 name" "table_row"
|
||||
And I should see "qbanktag2" in the "question 04 name" "table_row"
|
||||
And I apply question bank filter "Tag" with value "qbanktag1"
|
||||
@@ -91,6 +93,7 @@ Feature: Adding questions to a quiz from the question bank
|
||||
When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as teacher1
|
||||
And I open the "last" add to quiz menu
|
||||
And I follow "from question bank"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I should see "question 01 name" in the "categoryquestions" "table"
|
||||
And I should see "question 02 name" in the "categoryquestions" "table"
|
||||
And I should not see "Feature question" in the "categoryquestions" "table"
|
||||
@@ -149,6 +152,7 @@ Feature: Adding questions to a quiz from the question bank
|
||||
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
||||
When I open the "Page 1" add to quiz menu
|
||||
And I follow "from question bank"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I set the field with xpath "//tr[contains(normalize-space(.), 'question 03 name')]//input[@type='checkbox']" to "1"
|
||||
And I click on "Add selected questions to the quiz" "button"
|
||||
Then I should see "question 03 name" on quiz page "1"
|
||||
@@ -158,6 +162,7 @@ Feature: Adding questions to a quiz from the question bank
|
||||
Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
||||
When I open the "last" add to quiz menu
|
||||
And I follow "from question bank"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I set the field with xpath "//input[@type='checkbox' and @id='qbheadercheckbox']" to "1"
|
||||
And I press "Add selected questions to the quiz"
|
||||
Then I should see "question 01 name" on quiz page "1"
|
||||
@@ -170,9 +175,11 @@ Feature: Adding questions to a quiz from the question bank
|
||||
When I open the "last" add to quiz menu
|
||||
And I follow "from question bank"
|
||||
Then I should see "Current bank: Quiz 1"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I should see "question 01 name"
|
||||
And I click on "Switch bank" "button"
|
||||
And I click on "Qbank 1 & < > \" ' &" "link" in the "Select question bank" "dialogue"
|
||||
And I apply question bank filter "Category" with value "Qbank questions"
|
||||
And I should see "question 03 name"
|
||||
But I should not see "question 01 name"
|
||||
And I click on "Select" "checkbox" in the "question 03 name" "table_row"
|
||||
@@ -188,6 +195,7 @@ Feature: Adding questions to a quiz from the question bank
|
||||
And I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
||||
When I open the "last" add to quiz menu
|
||||
And I follow "from question bank"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I click on "Sort by Question ascending" "link"
|
||||
Then "question 01 name" "text" should appear before "question 02 name" "text"
|
||||
And I click on "Sort by Question descending" "link"
|
||||
@@ -206,6 +214,7 @@ Feature: Adding questions to a quiz from the question bank
|
||||
When I set the field "Shuffle" to "1"
|
||||
And I open the "last" add to quiz menu
|
||||
And I follow "from question bank"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
Then I should see "question 01 name"
|
||||
|
||||
Scenario: Question bank names are displayed in quiz questions
|
||||
@@ -236,6 +245,7 @@ Feature: Adding questions to a quiz from the question bank
|
||||
And I follow "from question bank"
|
||||
And I click on "Switch bank" "button"
|
||||
And I click on "Qbank 1 & < > \" ' &" "link" in the "Select question bank" "dialogue"
|
||||
And I apply question bank filter "Category" with value "Qbank questions"
|
||||
And I click on "Select" "checkbox" in the "question 03 name" "table_row"
|
||||
And I click on "Add selected questions to the quiz" "button"
|
||||
When the following "role assigns" exist:
|
||||
|
||||
@@ -57,6 +57,7 @@ Feature: Adding random questions to a quiz based on category and tags
|
||||
Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
||||
When I open the "last" add to quiz menu
|
||||
And I follow "a random question"
|
||||
And I apply question bank filter "Category" with value "Questions Category 1"
|
||||
And I apply question bank filter "Tag" with value "foo"
|
||||
And I wait until the page is ready
|
||||
And I should see "question 1 name"
|
||||
@@ -93,6 +94,7 @@ Feature: Adding random questions to a quiz based on category and tags
|
||||
Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
||||
And I open the "last" add to quiz menu
|
||||
And I follow "a random question"
|
||||
And I apply question bank filter "Category" with value "Questions Category 1"
|
||||
And I apply question bank filter "Tag" with value "foo"
|
||||
And I select "1" from the "randomcount" singleselect
|
||||
And I press "Add random question"
|
||||
@@ -107,6 +109,7 @@ Feature: Adding random questions to a quiz based on category and tags
|
||||
And I navigate to "Questions" in current page administration
|
||||
And I open the "Page 1" add to quiz menu
|
||||
And I follow "a random question"
|
||||
And I apply question bank filter "Category" with value "Questions Category 1"
|
||||
And I set the field "Also show questions from subcategories" to "1"
|
||||
And I click on "Apply filters" "button"
|
||||
And I apply question bank filter "Tag" with value "foo"
|
||||
@@ -176,12 +179,14 @@ Feature: Adding random questions to a quiz based on category and tags
|
||||
And I open the "last" add to quiz menu
|
||||
And I follow "a random question"
|
||||
And I should see "Current bank: Quiz 1"
|
||||
And I apply question bank filter "Category" with value "Questions Category 1"
|
||||
And I should see "question 1 name"
|
||||
And I click on "Switch bank" "button"
|
||||
And I click on "Qbank 1" "link" in the "Select question bank" "dialogue"
|
||||
And I should see "Current bank: Qbank 1"
|
||||
And I should see "Qbank question 1"
|
||||
And I should not see "question 1 name"
|
||||
And I apply question bank filter "Category" with value "Qbank questions"
|
||||
And I should see "Qbank question 1"
|
||||
When I apply question bank filter "Tag" with value "qbanktag"
|
||||
And I select "1" from the "randomcount" singleselect
|
||||
And I press "Add random question"
|
||||
@@ -218,6 +223,7 @@ Feature: Adding random questions to a quiz based on category and tags
|
||||
Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
||||
And I open the "last" add to quiz menu
|
||||
And I follow "a random question"
|
||||
And I apply question bank filter "Category" with value "Questions Category 1"
|
||||
And I apply question bank filter "Tag" with value "foo"
|
||||
And I select "1" from the "randomcount" singleselect
|
||||
And I press "Add random question"
|
||||
|
||||
@@ -40,12 +40,14 @@ Feature: Editing random questions already in a quiz based on category and tags
|
||||
Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
||||
And I open the "last" add to quiz menu
|
||||
And I follow "a random question"
|
||||
And I apply question bank filter "Category" with value "Questions Category 1"
|
||||
# To actually reproduce MDL-68733 it would be better to set tags easy,essay here, and then below just delete one tag.
|
||||
# However, the state of Behat for autocomplete fields does not let us actually do that.
|
||||
And I apply question bank filter "Tag" with value "easy"
|
||||
And I press "Add random question"
|
||||
And I open the "Page 1" add to quiz menu
|
||||
And I follow "a random question"
|
||||
And I apply question bank filter "Category" with value "Questions Category 1"
|
||||
And I apply question bank filter "Tag" with value "hard"
|
||||
And I press "Add random question"
|
||||
And I follow "Add page break"
|
||||
@@ -61,6 +63,7 @@ Feature: Editing random questions already in a quiz based on category and tags
|
||||
Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
||||
And I open the "last" add to quiz menu
|
||||
And I follow "a random question"
|
||||
And I apply question bank filter "Category" with value "Questions Category 1"
|
||||
And I apply question bank filter "Tag" with value "essay"
|
||||
And I press "Add random question"
|
||||
When I click on "Configure question" "link" in the "Random (Questions Category 1) based on filter condition with tags: essay" "list_item"
|
||||
@@ -76,6 +79,7 @@ Feature: Editing random questions already in a quiz based on category and tags
|
||||
Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
||||
And I open the "last" add to quiz menu
|
||||
And I follow "a random question"
|
||||
And I apply question bank filter "Category" with value "Questions Category 1"
|
||||
And I apply question bank filter "Tag" with value "essay"
|
||||
And I press "Add random question"
|
||||
When I click on "Configure question" "link" in the "Random (Questions Category 1) based on filter condition with tags: essay" "list_item"
|
||||
|
||||
@@ -254,6 +254,7 @@ Feature: Edit quiz page - remove multiple questions
|
||||
|
||||
When I open the "last" add to quiz menu
|
||||
And I follow "a random question"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I set the field "Number of random questions" to "3"
|
||||
And I press "Add random question"
|
||||
And I click on "Select multiple items" "button"
|
||||
|
||||
@@ -19,21 +19,18 @@ Feature: Edit quiz page - pagination
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber | questionsperpage | navmethod |
|
||||
| quiz | Quiz 1 | C1 | quiz1 | 0 | sequential |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | quiz1 | Quiz questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Quiz questions | truefalse | 1 | Question1 text |
|
||||
| Quiz questions | truefalse | 2 | Question2 text |
|
||||
| Quiz questions | truefalse | 3 | Question3 text |
|
||||
| Quiz questions | truefalse | 4 | Question4 text |
|
||||
| Quiz questions | truefalse | 5 | Question5 text |
|
||||
| Quiz questions | truefalse | 6 | Question6 text |
|
||||
| Quiz questions | truefalse | 7 | Question7 text |
|
||||
| Quiz questions | truefalse | 8 | Question8 text |
|
||||
| Quiz questions | truefalse | 9 | Question9 text |
|
||||
| Quiz questions | truefalse | 10 | Question10 text |
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Default for Quiz 1 | truefalse | 1 | Question1 text |
|
||||
| Default for Quiz 1 | truefalse | 2 | Question2 text |
|
||||
| Default for Quiz 1 | truefalse | 3 | Question3 text |
|
||||
| Default for Quiz 1 | truefalse | 4 | Question4 text |
|
||||
| Default for Quiz 1 | truefalse | 5 | Question5 text |
|
||||
| Default for Quiz 1 | truefalse | 6 | Question6 text |
|
||||
| Default for Quiz 1 | truefalse | 7 | Question7 text |
|
||||
| Default for Quiz 1 | truefalse | 8 | Question8 text |
|
||||
| Default for Quiz 1 | truefalse | 9 | Question9 text |
|
||||
| Default for Quiz 1 | truefalse | 10 | Question10 text |
|
||||
And quiz "Quiz 1" contains the following questions:
|
||||
| question | page |
|
||||
| 1 | 1 |
|
||||
|
||||
@@ -51,7 +51,7 @@ Feature: Switching question bank when adding questions to a quiz
|
||||
But "Qbank 4" "autocomplete_suggestions" should not exist
|
||||
And I click on "C2 - Qbank 3" item in the autocomplete list
|
||||
And I should see "Current bank: Qbank 3"
|
||||
And I should see "Test questions 3"
|
||||
And I should see "Default for Qbank 3"
|
||||
|
||||
Scenario: Viewing question banks not in the current course show as recently accessed
|
||||
Given "teacher" has recently viewed the "qbank1" "qbank" question bank
|
||||
|
||||
@@ -107,6 +107,7 @@ Feature: Quiz question versioning
|
||||
When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher"
|
||||
And I open the "Page 1" add to quiz menu
|
||||
And I follow "from question bank"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I click on "Select" "checkbox" in the "Other question" "table_row"
|
||||
And I press "Add selected questions to the quiz"
|
||||
Then I should see "Other question" on quiz page "1"
|
||||
@@ -118,6 +119,7 @@ Feature: Quiz question versioning
|
||||
| question | page |
|
||||
| First question | 1 |
|
||||
And I am on the "Quiz 1" "mod_quiz > Question bank" page logged in as teacher
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I set the field "question_status_dropdown" in the "First question" "table_row" to "Draft"
|
||||
When I am on the "Quiz 1" "mod_quiz > Edit" page
|
||||
Then I should see "This question is in draft status. To use it in the quiz, go to the question bank and change the status to ready."
|
||||
|
||||
@@ -21,7 +21,6 @@ Feature: Moving a question to another category should not affect random question
|
||||
| qbank | Qbank 1 | Question bank 1 | C1 | qbank1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | questioncategory | name |
|
||||
| Activity module | qbank1 | Top | top |
|
||||
| Activity module | qbank1 | top | Default for Qbank 1 |
|
||||
| Activity module | qbank1 | Default for Qbank 1 | Subcategory |
|
||||
| Activity module | qbank1 | top | Used category |
|
||||
|
||||
@@ -50,12 +50,14 @@ Feature: Use the qbank plugin manager page for bulkmove
|
||||
And I should see "Bulk move questions"
|
||||
And I click on "Disable" "link" in the "Bulk move questions" "table_row"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions 1"
|
||||
And I click on "First question" "checkbox"
|
||||
And I click on "With selected" "button"
|
||||
Then I should not see question bulk action "move"
|
||||
And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
||||
And I click on "Enable" "link" in the "Bulk move questions" "table_row"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions 1"
|
||||
And I click on "First question" "checkbox"
|
||||
And I click on "With selected" "button"
|
||||
And I should see question bulk action "move"
|
||||
@@ -64,6 +66,7 @@ Feature: Use the qbank plugin manager page for bulkmove
|
||||
Scenario: Selecting a shared question bank limits the available categories to those belonging to the selected bank.
|
||||
Given I log in as "teacher1"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions 1"
|
||||
And I click on "First question" "checkbox"
|
||||
And I click on "With selected" "button"
|
||||
And I click on "move" "button"
|
||||
@@ -78,8 +81,9 @@ Feature: Use the qbank plugin manager page for bulkmove
|
||||
Then I should not see "C3 - Question bank 3" in the ".search-banks" "css_element"
|
||||
And I click on "C1 - Question bank 1" item in the autocomplete list
|
||||
Then I should not see "Test questions 1" in the ".search-categories .form-autocomplete-selection" "css_element"
|
||||
And the field "selectcategory" matches value "Test questions 2 (1)"
|
||||
And the field "selectcategory" matches value "Default for Question bank 1"
|
||||
And I open the autocomplete suggestions list in the ".search-categories" "css_element"
|
||||
And "Test questions 2 (1)" "autocomplete_suggestions" should exist
|
||||
And "Test questions 3" "autocomplete_suggestions" should not exist
|
||||
And "Test questions 4" "autocomplete_suggestions" should not exist
|
||||
And "Test questions 5" "autocomplete_suggestions" should exist
|
||||
@@ -88,6 +92,7 @@ Feature: Use the qbank plugin manager page for bulkmove
|
||||
Scenario: Move a question from one bank category to another.
|
||||
Given I log in as "teacher1"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions 1"
|
||||
And I click on "First question" "checkbox"
|
||||
And I click on "With selected" "button"
|
||||
And I click on "move" "button"
|
||||
@@ -107,6 +112,7 @@ Feature: Use the qbank plugin manager page for bulkmove
|
||||
| Test questions | missingtype | Question 2 | Write something |
|
||||
| Test questions | essay | Question 3 | frog |
|
||||
And I am on the "Course 1" "core_question > course question bank" page logged in as teacher1
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
# Select questions to be moved.
|
||||
And I click on "Question 1" "checkbox"
|
||||
And I click on "Question 2" "checkbox"
|
||||
@@ -129,6 +135,7 @@ Feature: Use the qbank plugin manager page for bulkmove
|
||||
@javascript
|
||||
Scenario: Unable to bulk move questions from history page
|
||||
Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
|
||||
And I apply question bank filter "Category" with value "Test questions 1"
|
||||
And I choose "History" action for "First question" in the question bank
|
||||
And I click on "First question" "checkbox"
|
||||
And I click on "With selected" "button"
|
||||
@@ -161,6 +168,7 @@ Feature: Use the qbank plugin manager page for bulkmove
|
||||
| reference | qbank4 |
|
||||
| name | Test questions 7 |
|
||||
Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
|
||||
And I apply question bank filter "Category" with value "Test questions 1"
|
||||
And I press "Create a new question ..."
|
||||
And I set the field "item_qtype_truefalse" to "1"
|
||||
# Manually create a new question so additional parameters are included in the URL, and we can test they are handled correctly
|
||||
@@ -174,14 +182,15 @@ Feature: Use the qbank plugin manager page for bulkmove
|
||||
And I click on "With selected" "button"
|
||||
And I click on "move" "button"
|
||||
And the field "searchbanks" matches value "C1 - Test quiz"
|
||||
And the field "selectcategory" matches value "Test questions 1 (2)"
|
||||
And the field "selectcategory" matches value "Default for Test quiz"
|
||||
And I open the autocomplete suggestions list in the ".search-banks" "css_element"
|
||||
And I should see "C1 - Question bank 1" in the ".search-banks .form-autocomplete-suggestions" "css_element"
|
||||
And I should see "C2 - Question bank 2" in the ".search-banks .form-autocomplete-suggestions" "css_element"
|
||||
And I should see "C4 - Question bank 4" in the ".search-banks .form-autocomplete-suggestions" "css_element"
|
||||
And I should not see "C3 - Question bank 3" in the ".search-banks .form-autocomplete-suggestions" "css_element"
|
||||
And I click on "C1 - Question bank 1" item in the autocomplete list
|
||||
And the field "selectcategory" matches value "Test questions 2 (1)"
|
||||
And I open the autocomplete suggestions list in the ".question_category_selector" "css_element"
|
||||
And I click on "Test questions 2 (1)" item in the autocomplete list
|
||||
And I click on "Move questions" "button"
|
||||
And I should see "Are you sure you want to move these questions?"
|
||||
When I click on "Confirm" "button"
|
||||
@@ -191,6 +200,24 @@ Feature: Use the qbank plugin manager page for bulkmove
|
||||
And I click on "With selected" "button"
|
||||
And I click on "move" "button"
|
||||
And the field "searchbanks" matches value "C1 - Question bank 1"
|
||||
And the field "selectcategory" matches value "Test questions 2 (2)"
|
||||
And the field "selectcategory" matches value "Default for Question bank 1 (1)"
|
||||
# The moved question should be highlighted
|
||||
And the "class" attribute of "Seventh question" "table_row" should contain "highlight"
|
||||
|
||||
@javascript
|
||||
Scenario: A new question bank is available in the move dialogue immediately
|
||||
Given I am on the "C1" "Course" page logged in as "teacher1"
|
||||
And the following "user preferences" exist:
|
||||
| user | preference | value |
|
||||
| teacher1 | htmleditor | textarea |
|
||||
And I navigate to "Question banks" in current page administration
|
||||
And I press "Add"
|
||||
And I set the field "Question bank name" to "New question bank"
|
||||
And I press "Save and return to question bank list"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions 1"
|
||||
And I click on "First question" "checkbox"
|
||||
And I click on "With selected" "button"
|
||||
And I click on "move" "button"
|
||||
And I open the autocomplete suggestions list in the ".search-banks" "css_element"
|
||||
Then "New question bank" "autocomplete_suggestions" should exist
|
||||
|
||||
@@ -116,6 +116,7 @@ Feature: A Teacher can comment in a question
|
||||
Given I am on the "Test quiz" "mod_quiz > edit" page logged in as "teacher1"
|
||||
And I press "Add"
|
||||
And I follow "from question bank"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I click on "Select" "checkbox" in the "First question" "table_row"
|
||||
And I click on "Add selected questions to the quiz" "button"
|
||||
And I click on "Preview question" "link"
|
||||
@@ -126,6 +127,7 @@ Feature: A Teacher can comment in a question
|
||||
And I should see "Some new comment"
|
||||
And I switch to the main window
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I choose "Preview" action for "First question" in the question bank
|
||||
And I click on "Comments" "link"
|
||||
And I should see "Some new comment"
|
||||
@@ -140,9 +142,8 @@ Feature: A Teacher can comment in a question
|
||||
|
||||
@javascript
|
||||
Scenario: Comments modal can change the version using dropdown
|
||||
Given I log in as "teacher1"
|
||||
And I am on the "Test quiz" "quiz activity" page
|
||||
When I navigate to "Question bank" in current page administration
|
||||
Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I should see "First question"
|
||||
And I choose "Edit question" action for "First question" in the question bank
|
||||
And I set the field "id_name" to "Renamed question v2"
|
||||
|
||||
@@ -23,8 +23,10 @@ Feature: Use the qbank plugin manager page for comment
|
||||
And I should see "Question comments"
|
||||
And I click on "Disable" "link" in the "Question comments" "table_row"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
Then "#categoryquestions .header.commentcount" "css_element" should not be visible
|
||||
And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
||||
And I click on "Enable" "link" in the "Question comments" "table_row"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And "#categoryquestions .header.commentcount" "css_element" should be visible
|
||||
|
||||
@@ -24,16 +24,19 @@ Feature: Use the qbank plugin manager page for deletequestion
|
||||
| Test questions | truefalse | Question 2 | Answer the second question |
|
||||
| Test questions | truefalse | Question 3 | Answer the third question |
|
||||
|
||||
@javascript
|
||||
Scenario: Enable/disable delete question column from the base view
|
||||
Given I log in as "admin"
|
||||
When I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
||||
And I should see "Delete question"
|
||||
And I click on "Disable" "link" in the "Delete question" "table_row"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
Then the "Delete" action should not exist for the "Question 1" question in the question bank
|
||||
And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
||||
And I click on "Enable" "link" in the "Delete question" "table_row"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And the "Delete" action should exist for the "Question 1" question in the question bank
|
||||
|
||||
@javascript
|
||||
@@ -43,17 +46,20 @@ Feature: Use the qbank plugin manager page for deletequestion
|
||||
And I should see "Delete question"
|
||||
And I click on "Disable" "link" in the "Delete question" "table_row"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I click on "With selected" "button"
|
||||
Then I should not see question bulk action "deleteselected"
|
||||
And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
||||
And I click on "Enable" "link" in the "Delete question" "table_row"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I click on "With selected" "button"
|
||||
And I should see question bulk action "deleteselected"
|
||||
|
||||
@javascript
|
||||
Scenario: I should not see the deleted questions in the base view
|
||||
Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "admin"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I click on "Question 1" "checkbox"
|
||||
And I click on "Question 2" "checkbox"
|
||||
And I click on "With selected" "button"
|
||||
@@ -70,6 +76,7 @@ Feature: Use the qbank plugin manager page for deletequestion
|
||||
| Tags | foo |
|
||||
And I click on "Save changes" "button"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I apply question bank filter "Tag" with value "foo"
|
||||
And I click on "Question 1" "checkbox"
|
||||
And I click on "With selected" "button"
|
||||
@@ -81,6 +88,7 @@ Feature: Use the qbank plugin manager page for deletequestion
|
||||
@javascript
|
||||
Scenario: Questions can be bulk deleted from the question bank
|
||||
Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
# Select questions to be deleted.
|
||||
And I click on "Question 1" "checkbox"
|
||||
And I click on "Question 2" "checkbox"
|
||||
|
||||
+4
-7
@@ -11,14 +11,11 @@ Feature: Filter questions by status
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| qbank | Qbank 1 | Question bank 1 | C1 | qbank1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | qbank1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext | status |
|
||||
| Test questions | truefalse | First question | Answer the first question | ready |
|
||||
| Test questions | numerical | Second question | Answer the second question | draft |
|
||||
| Test questions | essay | Third question | Answer the third question | ready |
|
||||
| questioncategory | qtype | name | questiontext | status |
|
||||
| Default for Qbank 1 | truefalse | First question | Answer the first question | ready |
|
||||
| Default for Qbank 1 | numerical | Second question | Answer the second question | draft |
|
||||
| Default for Qbank 1 | essay | Third question | Answer the third question | ready |
|
||||
|
||||
Scenario: Filter by ready status
|
||||
Given I am on the "Qbank 1" "core_question > question bank" page logged in as "admin"
|
||||
|
||||
@@ -9,13 +9,10 @@ Feature: Use the qbank plugin manager page for editquestion
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| quiz | Test quiz | C1 | quiz1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | quiz1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | First question | Answer the first question |
|
||||
| Test questions | truefalse | First question second | Answer the first question |
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Default for Test quiz | truefalse | First question | Answer the first question |
|
||||
| Default for Test quiz | truefalse | First question second | Answer the first question |
|
||||
|
||||
Scenario: Enable/disable edit question columns from the base view
|
||||
Given I log in as "admin"
|
||||
|
||||
@@ -9,12 +9,9 @@ Feature: Use the qbank plugin manager page for exporttoxml
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| quiz | Test quiz | C1 | quiz1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | quiz1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | First question | Answer the first question |
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Default for Test quiz | truefalse | First question | Answer the first question |
|
||||
|
||||
Scenario: Enable/disable exporttoxml column from the base view
|
||||
Given I log in as "admin"
|
||||
|
||||
@@ -17,9 +17,9 @@ Feature: Use the qbank plugin manager page for question history
|
||||
| Activity module | qbank1 | Share questions |
|
||||
| Activity module | qbank2 | Share questions 2 |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | First question | Answer the first question |
|
||||
| Share questions | essay | Test question to be edited | Write about whatever you want |
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Default for Test quiz | truefalse | First question | Answer the first question |
|
||||
| Default for Qbank 1 | essay | Test question to be edited | Write about whatever you want |
|
||||
|
||||
Scenario: Enable/disable question history column from the base view
|
||||
Given I log in as "admin"
|
||||
@@ -100,8 +100,8 @@ Feature: Use the qbank plugin manager page for question history
|
||||
| user | preference | value |
|
||||
| admin | qbank_columnsortorder_hiddencols | qbank_usage\question_last_used_column-question_last_used_column |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | Second question | Answer the second question |
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Default for Test quiz | truefalse | Second question | Answer the second question |
|
||||
When I am on the "Test quiz" "mod_quiz > question bank" page logged in as "admin"
|
||||
And "Last used" "qbank_columnsortorder > column header" should not exist
|
||||
Then I should see "First question"
|
||||
|
||||
@@ -18,13 +18,11 @@ Feature: A teacher can put questions in categories in the question bank
|
||||
| activity | name | course | idnumber |
|
||||
| qbank | Qbank 1 | C1 | qbank1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | questioncategory | name |
|
||||
| Activity module | qbank1 | Top | top |
|
||||
| Activity module | qbank1 | top | Default for qbank1 |
|
||||
| Activity module | qbank1 | Default for qbank1 | Subcategory & < > " ' & |
|
||||
| Activity module | qbank1 | Default for qbank1 | Another subcat |
|
||||
| Activity module | qbank1 | top | Used category |
|
||||
| Activity module | qbank1 | top | Default & testing |
|
||||
| contextlevel | reference | questioncategory | name |
|
||||
| Activity module | qbank1 | Default for Qbank 1 | Subcategory & < > " ' & |
|
||||
| Activity module | qbank1 | Default for Qbank 1 | Another subcat |
|
||||
| Activity module | qbank1 | top | Used category |
|
||||
| Activity module | qbank1 | top | Default & testing |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Used category | essay | Test question to be moved | Write about whatever you want |
|
||||
@@ -57,7 +55,7 @@ Feature: A teacher can put questions in categories in the question bank
|
||||
| Subcategory & < > " ' & | essay | Test question for renaming category | Write about whatever you want |
|
||||
And I open the action menu in "Subcategory & < > \" ' &" "list_item"
|
||||
And I choose "Edit settings" in the open action menu
|
||||
And the field "parent" matches value " Default for qbank1"
|
||||
And the field "parent" matches value " Default for Qbank 1"
|
||||
And I set the following fields to these values:
|
||||
| Name | New name |
|
||||
| Category info | I was edited |
|
||||
@@ -81,11 +79,11 @@ Feature: A teacher can put questions in categories in the question bank
|
||||
And I choose "Delete" in the open action menu
|
||||
And I click on "Delete" "button" in the "Delete" "dialogue"
|
||||
And I should see "The category 'Used category' contains 1 questions"
|
||||
And I select "Default for qbank1" from the "Category" singleselect
|
||||
And I select "Default for Qbank 1" from the "Category" singleselect
|
||||
And I press "Save in category"
|
||||
Then I should not see "Used category"
|
||||
And I press "Add category"
|
||||
And I should see "Default for qbank1 (1)"
|
||||
And I should see "Default for Qbank 1 (1)"
|
||||
|
||||
@_file_upload
|
||||
Scenario: Multi answer questions with their child questions can be moved to another category when the current category is deleted
|
||||
@@ -107,7 +105,7 @@ Feature: A teacher can put questions in categories in the question bank
|
||||
|
||||
Scenario: Filter questions by category and subcategories
|
||||
When I am on the "Qbank 1" "core_question > question bank" page
|
||||
And I apply question bank filter "Category" with value "Default for qbank1"
|
||||
And I apply question bank filter "Category" with value "Default for Qbank 1"
|
||||
Then I should not see "Question 1"
|
||||
When I set the field "Also show questions from subcategories" to "1"
|
||||
And I click on "Apply filters" "button"
|
||||
@@ -127,6 +125,7 @@ Feature: A teacher can put questions in categories in the question bank
|
||||
And I follow "from question bank"
|
||||
And I click on "Switch bank" "button"
|
||||
And I click on "Qbank 1" "link" in the "Select question bank" "dialogue"
|
||||
And I apply question bank filter "Category" with value "Default for Qbank 1"
|
||||
When I set the field "Also show questions from subcategories" to "1"
|
||||
And I click on "Apply filters" "button"
|
||||
Then I should see "Question 1" in the "categoryquestions" "table"
|
||||
@@ -140,7 +139,7 @@ Feature: A teacher can put questions in categories in the question bank
|
||||
|
||||
Scenario: Filter question by an invalid category should show validation error
|
||||
When I am on the "Qbank 1" "core_question > question bank" page
|
||||
And I click on "Default for qbank1" "text" in the ".form-autocomplete-selection" "css_element"
|
||||
And I click on "Default for Qbank 1" "text" in the ".form-autocomplete-selection" "css_element"
|
||||
And I click on "Apply filters" "button"
|
||||
Then the "Category" field validity check should return "false"
|
||||
And the "Category" field validation message should contain "You must select a valid category"
|
||||
@@ -148,7 +147,7 @@ Feature: A teacher can put questions in categories in the question bank
|
||||
Scenario: Correcting an invalid category should no longer show validation error
|
||||
When I am on the "Qbank 1" "core_question > question bank" page
|
||||
# First try to submit with a blank category.
|
||||
And I click on "Default for qbank1" "text" in the ".form-autocomplete-selection" "css_element"
|
||||
And I click on "Default for Qbank 1" "text" in the ".form-autocomplete-selection" "css_element"
|
||||
And I click on "Apply filters" "button"
|
||||
# Then apply a correct category.
|
||||
And I apply question bank filter "Category" with value "Used category"
|
||||
|
||||
@@ -24,7 +24,6 @@ Feature: A teacher can put questions with idnumbers in categories with idnumbers
|
||||
# Note need to create the top category each time.
|
||||
When the following "question categories" exist:
|
||||
| contextlevel | reference | questioncategory | name | idnumber |
|
||||
| Activity module | qbank1 | Top | top | |
|
||||
| Activity module | qbank1 | top | Used category | c1used |
|
||||
And I am on the "Qbank 1" "core_question > question categories" page
|
||||
And I press "Add category"
|
||||
@@ -49,7 +48,6 @@ Feature: A teacher can put questions with idnumbers in categories with idnumbers
|
||||
Scenario: A question category can be edited and saved without changing the idnumber
|
||||
When the following "question categories" exist:
|
||||
| contextlevel | reference | questioncategory | name | idnumber |
|
||||
| Activity module | qbank1 | Top | top | |
|
||||
| Activity module | qbank1 | top | Used category | c1used |
|
||||
And I am on the "Qbank 1" "core_question > question categories" page
|
||||
Then I open the action menu in "Used category" "list_item"
|
||||
|
||||
+14
-10
@@ -80,10 +80,14 @@ final class move_category_test extends \qbank_managecategories\manage_category_t
|
||||
$this->create_course_category();
|
||||
|
||||
// Question categories.
|
||||
$qcat1 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat1 = question_get_default_category($context->id);
|
||||
$qcat2 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat3 = $this->create_question_category_for_a_qbank($qbank);
|
||||
|
||||
$this->assertEquals(999, $qcat1->sortorder);
|
||||
$this->assertEquals(1000, $qcat2->sortorder);
|
||||
$this->assertEquals(1001, $qcat3->sortorder);
|
||||
|
||||
// Check current order.
|
||||
$currentorder = $this->get_current_order($context);
|
||||
$expectedorder = [
|
||||
@@ -111,7 +115,7 @@ final class move_category_test extends \qbank_managecategories\manage_category_t
|
||||
'action' => 'put',
|
||||
'fields' => (object)[
|
||||
'id' => $qcat1->id,
|
||||
'sortorder' => 3,
|
||||
'sortorder' => 1001,
|
||||
],
|
||||
],
|
||||
(object)[
|
||||
@@ -119,7 +123,7 @@ final class move_category_test extends \qbank_managecategories\manage_category_t
|
||||
'action' => 'put',
|
||||
'fields' => (object)[
|
||||
'id' => $qcat3->id,
|
||||
'sortorder' => 4,
|
||||
'sortorder' => 1002,
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -142,7 +146,7 @@ final class move_category_test extends \qbank_managecategories\manage_category_t
|
||||
$this->create_course_category();
|
||||
|
||||
// Question categories.
|
||||
$qcat1 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat1 = question_get_default_category($context->id);
|
||||
$qcat2 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat3 = $this->create_question_category_for_a_qbank($qbank);
|
||||
|
||||
@@ -211,7 +215,7 @@ final class move_category_test extends \qbank_managecategories\manage_category_t
|
||||
$this->create_course_category();
|
||||
|
||||
// Question categories.
|
||||
$qcat1 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat1 = question_get_default_category($context->id);
|
||||
$qcat2 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat3 = $this->create_question_category_for_a_qbank($qbank);
|
||||
|
||||
@@ -284,7 +288,7 @@ final class move_category_test extends \qbank_managecategories\manage_category_t
|
||||
$this->create_course_category();
|
||||
|
||||
// Question categories.
|
||||
$qcat1 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat1 = question_get_default_category($context->id);
|
||||
$qcat2 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat3 = $this->create_question_category_for_a_qbank($qbank, ['parent' => $qcat1->id]);
|
||||
$qcat4 = $this->create_question_category_for_a_qbank($qbank, ['parent' => $qcat2->id]);
|
||||
@@ -347,7 +351,7 @@ final class move_category_test extends \qbank_managecategories\manage_category_t
|
||||
$this->create_course_category();
|
||||
|
||||
// Question categories.
|
||||
$qcat1 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat1 = question_get_default_category($context->id);
|
||||
$qcat2 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat3 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat4 = $this->create_question_category_for_a_qbank($qbank, ['parent' => $qcat3->id]);
|
||||
@@ -385,7 +389,7 @@ final class move_category_test extends \qbank_managecategories\manage_category_t
|
||||
'action' => 'put',
|
||||
'fields' => (object)[
|
||||
'id' => $qcat3->id,
|
||||
'sortorder' => 2,
|
||||
'sortorder' => 1000,
|
||||
],
|
||||
],
|
||||
(object)[
|
||||
@@ -393,7 +397,7 @@ final class move_category_test extends \qbank_managecategories\manage_category_t
|
||||
'action' => 'put',
|
||||
'fields' => (object)[
|
||||
'id' => $qcat2->id,
|
||||
'sortorder' => 3,
|
||||
'sortorder' => 1001,
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -417,7 +421,7 @@ final class move_category_test extends \qbank_managecategories\manage_category_t
|
||||
$this->create_course_category();
|
||||
|
||||
// Question categories.
|
||||
$qcat1 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat1 = question_get_default_category($context->id);
|
||||
$qcat2 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat3 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat4 = $this->create_question_category_for_a_qbank($qbank, ['parent' => $qcat3->id]);
|
||||
|
||||
@@ -275,7 +275,8 @@ final class helper_test extends manage_category_test_base {
|
||||
|
||||
// Create categories.
|
||||
$quiz = $this->create_quiz();
|
||||
$qcategory1 = $this->create_question_category_for_a_quiz($quiz);
|
||||
$context = \context_module::instance($quiz->cmid);
|
||||
$qcategory1 = question_get_default_category($context->id);
|
||||
$this->create_question_category_for_a_quiz($quiz, ['parent' => $qcategory1->id]);
|
||||
$this->create_question_category_for_a_quiz($quiz);
|
||||
|
||||
@@ -307,7 +308,8 @@ final class helper_test extends manage_category_test_base {
|
||||
|
||||
// Create categories.
|
||||
$quiz = $this->create_quiz();
|
||||
$qcategory1 = $this->create_question_category_for_a_quiz($quiz);
|
||||
$context = \context_module::instance($quiz->cmid);
|
||||
$qcategory1 = question_get_default_category($context->id);
|
||||
$qcategory2 = $this->create_question_category_for_a_quiz($quiz, ['parent' => $qcategory1->id]);
|
||||
$qcategory3 = $this->create_question_category_for_a_quiz($quiz);
|
||||
|
||||
@@ -339,12 +341,13 @@ final class helper_test extends manage_category_test_base {
|
||||
global $DB;
|
||||
// Create quiz.
|
||||
$quiz = $this->quiz;
|
||||
// Create category 1 and one hidden question.
|
||||
$qcat = $this->create_question_category_for_a_quiz($quiz);
|
||||
$context = \context_module::instance($quiz->cmid);
|
||||
// Get the question category and create one hidden question.
|
||||
$qcat = question_get_default_category($context->id);
|
||||
$q1 = $this->create_question_in_a_category('shortanswer', $qcat->id);
|
||||
$DB->set_field('question_versions', 'status', 'hidden', ['questionid' => $q1->id]);
|
||||
|
||||
$contexts = new \core_question\local\bank\question_edit_contexts(\context_module::instance($quiz->cmid));
|
||||
$contexts = new \core_question\local\bank\question_edit_contexts($context);
|
||||
$contexts = $contexts->having_cap('moodle/question:add');
|
||||
foreach ($contexts as $context) {
|
||||
$contextslist[] = $context->id;
|
||||
|
||||
@@ -40,11 +40,11 @@ final class question_categories_test extends manage_category_test_base {
|
||||
|
||||
// Create question categories for a course.
|
||||
$qbank = $this->create_qbank($this->create_course());
|
||||
$qcat1 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$context = \context_module::instance($qbank->cmid);
|
||||
$qcat1 = question_get_default_category($context->id);
|
||||
$qcat2 = $this->create_question_category_for_a_qbank($qbank, ['parent' => $qcat1->id]);
|
||||
$qcat3 = $this->create_question_category_for_a_qbank($qbank);
|
||||
$qcat4 = $this->create_question_category_for_a_qbank($qbank, ['parent' => $qcat2->id]);
|
||||
$context = \context_module::instance($qbank->cmid);
|
||||
|
||||
// Create ordered tree.
|
||||
$questioncategories = new question_categories(
|
||||
|
||||
@@ -17,12 +17,9 @@ Feature: A teacher can preview questions in the question bank
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | quiz1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name |
|
||||
| Test questions | numerical | Test question to be previewed |
|
||||
| questioncategory | qtype | name |
|
||||
| Default for Test quiz | numerical | Test question to be previewed |
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
|
||||
When I choose "Preview" action for "Test question to be previewed" in the question bank
|
||||
|
||||
@@ -115,8 +112,8 @@ Feature: A teacher can preview questions in the question bank
|
||||
|
||||
Scenario: The preview always uses the latest question version by default.
|
||||
Given the following "core_question > updated questions" exist:
|
||||
| questioncategory | question | questiontext |
|
||||
| Test questions | Test question to be previewed | Question version 2 |
|
||||
| questioncategory | question | questiontext |
|
||||
| Default for Test quiz | Test question to be previewed | Question version 2 |
|
||||
And I should see "Version 1 (latest)"
|
||||
And I expand all fieldsets
|
||||
And the field "Question version" matches value "Always latest"
|
||||
@@ -130,8 +127,8 @@ Feature: A teacher can preview questions in the question bank
|
||||
Scenario: Detect a newer version during always latest preview and offer to switch to the latest
|
||||
Given I should not see "This preview is using version 1"
|
||||
And the following "core_question > updated questions" exist:
|
||||
| questioncategory | question | questiontext |
|
||||
| Test questions | Test question to be previewed | Question version 2 |
|
||||
| questioncategory | question | questiontext |
|
||||
| Default for Test quiz | Test question to be previewed | Question version 2 |
|
||||
And I should see "Version 1 (latest)"
|
||||
And I set the field "Answer:" to "3.14"
|
||||
When I press "Submit and finish"
|
||||
@@ -143,8 +140,8 @@ Feature: A teacher can preview questions in the question bank
|
||||
Scenario: Previewing from the question history will not always show the latest version
|
||||
Given I press "Close preview"
|
||||
And the following "core_question > updated questions" exist:
|
||||
| questioncategory | question | questiontext |
|
||||
| Test questions | Test question to be previewed | Question version 2 |
|
||||
| questioncategory | question | questiontext |
|
||||
| Default for Test quiz | Test question to be previewed | Question version 2 |
|
||||
And I choose "History" action for "Test question to be previewed" in the question bank
|
||||
And I choose "Preview" action for "Test question to be previewed" in the question bank
|
||||
And I should see "Version 1 (of 2)"
|
||||
@@ -155,8 +152,8 @@ Feature: A teacher can preview questions in the question bank
|
||||
And I should see "Version 1 (of 2)"
|
||||
And I should not see "The latest version is 2."
|
||||
And the following "core_question > updated questions" exist:
|
||||
| questioncategory | question | questiontext |
|
||||
| Test questions | Test question to be previewed | Question version 3 |
|
||||
| questioncategory | question | questiontext |
|
||||
| Default for Test quiz | Test question to be previewed | Question version 3 |
|
||||
When I press "Start again"
|
||||
Then I should see "Version 1 (of 3)"
|
||||
And I should not see "Version 3 (latest)"
|
||||
|
||||
@@ -9,12 +9,9 @@ Feature: Use the qbank plugin manager page for previewquestion
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| quiz | Test quiz | C1 | quiz1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | quiz1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | First question | Answer the first question |
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Default for Test quiz | truefalse | First question | Answer the first question |
|
||||
|
||||
Scenario: Enable/disable previewquestion column from the base view
|
||||
Given I log in as "admin"
|
||||
|
||||
@@ -9,12 +9,9 @@ Feature: Use the qbank plugin manager page for statistics
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| quiz | Test quiz | C1 | quiz1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | quiz1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | First question | Answer the first question |
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Default for Test quiz | truefalse | First question | Answer the first question |
|
||||
|
||||
Scenario: Enable/disable statistics columns from the base view
|
||||
Given I log in as "admin"
|
||||
|
||||
@@ -21,15 +21,12 @@ Feature: Show statistics in question bank
|
||||
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 |
|
||||
| quiz | Quiz 2 | Quiz 2 description | C1 | quiz2 |
|
||||
| qbank | Qbank 1 | Question bank 1 | C1 | qbank1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | qbank1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | TF1 | First question |
|
||||
| Test questions | truefalse | TF2 | Second question |
|
||||
| Test questions | truefalse | TF3 | Third question |
|
||||
| Test questions | truefalse | TF4 | Fourth question |
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Default for Qbank 1 | truefalse | TF1 | First question |
|
||||
| Default for Qbank 1 | truefalse | TF2 | Second question |
|
||||
| Default for Qbank 1 | truefalse | TF3 | Third question |
|
||||
| Default for Qbank 1 | truefalse | TF4 | Fourth question |
|
||||
And quiz "Quiz 1" contains the following questions:
|
||||
| question | page | maxmark |
|
||||
| TF1 | 1 | 1.0 |
|
||||
@@ -151,16 +148,13 @@ Feature: Show statistics in question bank
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| quiz | Quiz 3 | C2 | quiz3 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | quiz3 | Quiz questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | template | name |
|
||||
| Quiz questions | multichoice | one_of_four | MCA |
|
||||
| Quiz questions | multichoice | one_of_four | MCB |
|
||||
| Quiz questions | multichoice | one_of_four | MCC |
|
||||
| Quiz questions | multichoice | one_of_four | MCD |
|
||||
| Quiz questions | multichoice | one_of_four | MCE |
|
||||
| questioncategory | qtype | template | name |
|
||||
| Default for Quiz 3 | multichoice | one_of_four | MCA |
|
||||
| Default for Quiz 3 | multichoice | one_of_four | MCB |
|
||||
| Default for Quiz 3 | multichoice | one_of_four | MCC |
|
||||
| Default for Quiz 3 | multichoice | one_of_four | MCD |
|
||||
| Default for Quiz 3 | multichoice | one_of_four | MCE |
|
||||
And quiz "Quiz 3" contains the following questions:
|
||||
| question | page | maxmark |
|
||||
| MCA | 1 | 1.0 |
|
||||
|
||||
@@ -9,12 +9,9 @@ Feature: Use the qbank plugin manager page for tagquestion
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| quiz | Test quiz | C1 | quiz1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | quiz1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | First question | Answer the first question |
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Default for Test quiz | truefalse | First question | Answer the first question |
|
||||
|
||||
Scenario: Enable/disable tagquestion column from the base view
|
||||
Given I log in as "admin"
|
||||
|
||||
@@ -23,9 +23,11 @@ Feature: Use the qbank plugin manager page for question last used
|
||||
When I click on "Disable" "link" in the "Question usage" "table_row"
|
||||
And I am on the "Test quiz" "quiz activity" page
|
||||
And I navigate to "Question bank" in current page administration
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
Then I should not see "Last used"
|
||||
And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
||||
And I click on "Enable" "link" in the "Question usage" "table_row"
|
||||
And I am on the "Test quiz" "quiz activity" page
|
||||
And I navigate to "Question bank" in current page administration
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I should see "Last used"
|
||||
|
||||
@@ -9,12 +9,9 @@ Feature: Use the qbank plugin manager page for question usage
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| quiz | Test quiz | C1 | quiz1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | quiz1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | First question | Answer the first question |
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Default for Test quiz | truefalse | First question | Answer the first question |
|
||||
And I change window size to "large"
|
||||
|
||||
Scenario: Enable/disable question usage column from the base view
|
||||
@@ -32,8 +29,7 @@ Feature: Use the qbank plugin manager page for question usage
|
||||
@javascript
|
||||
Scenario: Question usage modal should work without any usage data
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page logged in as "admin"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I should see "Test questions"
|
||||
And I should see "Default for Test quiz"
|
||||
And I should see "0" on the usage column
|
||||
When I click "0" on the usage column
|
||||
Then I should see "Version 1"
|
||||
@@ -47,8 +43,7 @@ Feature: Use the qbank plugin manager page for question usage
|
||||
| question | page |
|
||||
| First question | 1 |
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page logged in as "admin"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I should see "Test questions"
|
||||
And I should see "Default for Test quiz"
|
||||
And I should see "1" on the usage column
|
||||
When I click "1" on the usage column
|
||||
Then "Test quiz" "table_row" should exist in the "question-usage_table" "region"
|
||||
|
||||
@@ -30,6 +30,7 @@ Feature: Filter questions by creator name
|
||||
| truefalse | Test questions | Second question | bb |
|
||||
| truefalse | Test questions | Third question | cc |
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "admin"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I should see "First question"
|
||||
And I should see "Second question"
|
||||
And I should see "Third question"
|
||||
|
||||
@@ -35,6 +35,7 @@ Feature: Filter questions by modifier name
|
||||
| Test questions | Second question | Second question | bb |
|
||||
| Test questions | Third question | Third question | cc |
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "admin"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I should see "First question"
|
||||
And I should see "Second question"
|
||||
And I should see "Third question"
|
||||
|
||||
@@ -25,6 +25,7 @@ Feature: Time modified filter condition
|
||||
| Test questions | Second question | Second question | ## 2024-01-10 11:00 ## |
|
||||
| Test questions | Third question | Third question | ## 2024-01-10 12:00 ## |
|
||||
Given I am on the "Qbank 1" "core_question > question bank" page logged in as "admin"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I should see "First question"
|
||||
And I should see "Second question"
|
||||
And I should see "Third question"
|
||||
|
||||
+1
@@ -20,6 +20,7 @@ Feature: Filter questions by idnumber
|
||||
| Test questions | numerical | b | Answer the second question | q_02_bc |
|
||||
| Test questions | essay | c | Answer the third question | Q_21_ca |
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "admin"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I should see "q_01_ab"
|
||||
And I should see "q_02_bc"
|
||||
And I should see "Q_21_ca"
|
||||
|
||||
+3
-6
@@ -11,14 +11,11 @@ Feature: Filter questions by name
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| qbank | Qbank 1 | Question bank 1 | C1 | qbank1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | qbank1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | First question | Answer the first question |
|
||||
| Test questions | numerical | Second question | Answer the second question |
|
||||
| Test questions | essay | Third Question | Answer the third question |
|
||||
| Default for Qbank 1 | truefalse | First question | Answer the first question |
|
||||
| Default for Qbank 1 | numerical | Second question | Answer the second question |
|
||||
| Default for Qbank 1 | essay | Third Question | Answer the third question |
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "admin"
|
||||
And I should see "First question"
|
||||
And I should see "Second question"
|
||||
|
||||
@@ -9,12 +9,9 @@ Feature: Use the qbank plugin manager page for viewquestionname
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber |
|
||||
| quiz | Test quiz | C1 | quiz1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | quiz1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | First question | Answer the first question |
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Default for Test quiz | truefalse | First question | Answer the first question |
|
||||
|
||||
Scenario: Enable/disable viewquestionname column from the base view
|
||||
Given I log in as "admin"
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ Feature: Filter questions by text found in the question text or general feedback
|
||||
| Test questions | truefalse | Question 4 | GHI | CDEZ |
|
||||
| Test questions | truefalse | Question 5 | IJK | GHI |
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "admin"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I should see "Question 1"
|
||||
And I should see "Question 2"
|
||||
And I should see "Question 3"
|
||||
|
||||
@@ -19,6 +19,7 @@ Feature: Use the qbank plugin manager page for viewquestiontext
|
||||
@javascript
|
||||
Scenario: Display of plain question text can be turned on and off
|
||||
When I am on the "Test quiz" "mod_quiz > question bank" page logged in as admin
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I set the field "Show question text in the question list?" to "text only"
|
||||
Then I should see "Answer the first <question>"
|
||||
And ".totestforhtml" "css_element" should not exist in the "Answer the first <question>" "table_row"
|
||||
@@ -28,6 +29,7 @@ Feature: Use the qbank plugin manager page for viewquestiontext
|
||||
@javascript
|
||||
Scenario: Display of full question text can be turned on and off
|
||||
When I am on the "Test quiz" "mod_quiz > question bank" page logged in as admin
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I set the field "Show question text in the question list?" to "with images"
|
||||
Then I should see "Answer the first <question>"
|
||||
And ".totestforhtml" "css_element" should exist in the "Answer the first <question>" "table_row"
|
||||
@@ -53,5 +55,6 @@ Feature: Use the qbank plugin manager page for viewquestiontext
|
||||
And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
||||
And I click on "Enable" "link" in the "View question text" "table_row"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
When I set the field "Show question text in the question list?" to "text only"
|
||||
And I should see "Answer the first <question>"
|
||||
|
||||
+5
-10
@@ -11,31 +11,26 @@ Feature: Filter questions by type
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| qbank | Qbank 1 | Question bank 1 | C1 | qbank1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | qbank1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | First question | Answer the first question |
|
||||
| Test questions | numerical | Second question | Answer the second question |
|
||||
| Test questions | essay | Third question | Answer the third question |
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Default for Qbank 1 | truefalse | First question | Answer the first question |
|
||||
| Default for Qbank 1 | numerical | Second question | Answer the second question |
|
||||
| Default for Qbank 1 | essay | Third question | Answer the third question |
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "admin"
|
||||
|
||||
Scenario: Filter by a single type
|
||||
Given I am on the "Qbank 1" "core_question > question bank" page logged in as "admin"
|
||||
When I apply question bank filter "Type" with value "True/False"
|
||||
Then I should see "First question"
|
||||
And I should not see "Second question"
|
||||
And I should not see "Third question"
|
||||
|
||||
Scenario: Filter by multiple types
|
||||
Given I am on the "Qbank 1" "core_question > question bank" page logged in as "admin"
|
||||
When I apply question bank filter "Type" with value "True/False, Essay"
|
||||
Then I should see "First question"
|
||||
And I should not see "Second question"
|
||||
And I should see "Third question"
|
||||
|
||||
Scenario: Exclude types by filter
|
||||
Given I am on the "Qbank 1" "core_question > question bank" page logged in as "admin"
|
||||
When I add question bank filter "Type"
|
||||
And I set the field "Type" to "True/False, Essay"
|
||||
And I set the field "Match" in the "Filter 3" "fieldset" to "None"
|
||||
|
||||
@@ -23,8 +23,10 @@ Feature: Use the qbank plugin manager page for viewquestiontype
|
||||
And I should see "View question type"
|
||||
And I click on "Disable" "link" in the "View question type" "table_row"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
Then "#categoryquestions .header.qtype" "css_element" should not be visible
|
||||
And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
||||
And I click on "Enable" "link" in the "View question type" "table_row"
|
||||
And I am on the "Test quiz" "mod_quiz > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And "#categoryquestions .header.qtype" "css_element" should be visible
|
||||
|
||||
@@ -611,6 +611,9 @@ class question_bank_helper {
|
||||
$data->name = $bankname;
|
||||
$data->type = in_array($type, self::SHARED_TYPES) ? $type : self::TYPE_STANDARD;
|
||||
$data->showdescription = $type === self::TYPE_STANDARD ? 0 : 1;
|
||||
// Don't create the default category if this is being created by the system as part of a migration or restore,
|
||||
// existing categories will be migrated to the new context.
|
||||
$data->skipdefaultcategory = $type === self::TYPE_SYSTEM;
|
||||
|
||||
$mod = add_moduleinfo($data, $course);
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ Feature: Test exporting questions using Aiken format.
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | qbank1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | template |
|
||||
| Test questions | multichoice | Multi-choice-001 | two_of_four |
|
||||
| Test questions | multichoice | Multi-choice-002 | one_of_four |
|
||||
| questioncategory | qtype | name | template |
|
||||
| Default for Qbank 1 | multichoice | Multi-choice-001 | two_of_four |
|
||||
| Default for Qbank 1 | multichoice | Multi-choice-002 | one_of_four |
|
||||
|
||||
Scenario: Aiken export
|
||||
When I am on the "Qbank 1" "core_question > question export" page logged in as "teacher1"
|
||||
|
||||
@@ -141,7 +141,7 @@ final class backup_test extends \advanced_testcase {
|
||||
$qgen = $this->getDataGenerator()->get_plugin_generator('core_question');
|
||||
$qbank = $this->getDataGenerator()->create_module('qbank', ['course' => $course->id]);
|
||||
$context = \context_module::instance($qbank->cmid);
|
||||
$qcat = $qgen->create_question_category(['contextid' => $context->id]);
|
||||
$qcat = question_get_default_category($context->id);
|
||||
$question1 = $qgen->create_question('shortanswer', null, ['category' => $qcat->id, 'idnumber' => 'q1']);
|
||||
$question2 = $qgen->create_question('shortanswer', null, ['category' => $qcat->id, 'idnumber' => 'q2']);
|
||||
|
||||
@@ -174,7 +174,7 @@ final class backup_test extends \advanced_testcase {
|
||||
$this->assertCount(1, $qbanks);
|
||||
$qbank = reset($qbanks);
|
||||
$qbankcontext = \context_module::instance($qbank->id);
|
||||
$cats = $DB->get_records_select('question_categories' , 'parent <> 0', ['contextid' => $qbankcontext->id]);
|
||||
$cats = $DB->get_records_select('question_categories', 'parent <> 0 AND contextid = ?', [$qbankcontext->id]);
|
||||
$this->assertCount(1, $cats);
|
||||
$cat = reset($cats);
|
||||
|
||||
@@ -515,7 +515,7 @@ final class backup_test extends \advanced_testcase {
|
||||
['type' => question_bank_helper::TYPE_STANDARD, 'course' => $course->id]
|
||||
);
|
||||
$qbankcontext = \context_module::instance($qbank->cmid);
|
||||
$bankqcat = $qgen->create_question_category(['contextid' => $qbankcontext->id]);
|
||||
$bankqcat = question_get_default_category($qbankcontext->id);
|
||||
$bankquestion = $qgen->create_question('shortanswer',
|
||||
null,
|
||||
['name' => 'bank question', 'category' => $bankqcat->id, 'idnumber' => 'bankq1']
|
||||
@@ -524,7 +524,7 @@ final class backup_test extends \advanced_testcase {
|
||||
// Create a quiz module instance, a category for that module, and a question for that category.
|
||||
$quiz = self::getDataGenerator()->create_module('quiz', ['course' => $course->id]);
|
||||
$quizcontext = \context_module::instance($quiz->cmid);
|
||||
$quizqcat = $qgen->create_question_category(['contextid' => $quizcontext->id]);
|
||||
$quizqcat = question_get_default_category($quizcontext->id);
|
||||
$quizquestion = $qgen->create_question('shortanswer',
|
||||
null,
|
||||
['name' => 'quiz question', 'category' => $quizqcat->id, 'idnumber' => 'quizq1']
|
||||
|
||||
@@ -27,9 +27,8 @@ Feature: A bank view with questions can be managed
|
||||
| questioncategory | qtype | name | questiontext | idnumber |
|
||||
| Test questions | essay | Essay test question | Write about whatever you want | qid |
|
||||
| Test questions | numerical | Numerical test question | Write about whatever you want | qid |
|
||||
And I am on the "C1" "Course" page logged in as "teacher1"
|
||||
And I navigate to "Question banks" in current page administration
|
||||
And I click on "Qbank 1" "link"
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "teacher1"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I should see "Essay test question"
|
||||
And I should see "Numerical test question"
|
||||
And I choose "Delete" action for "Essay test question" in the question bank
|
||||
@@ -45,9 +44,8 @@ Feature: A bank view with questions can be managed
|
||||
| Test questions | missingtype | Unknown type question | Write about whatever you want |
|
||||
| Test questions | truefalse | Truefalse type question | Write about whatever you want |
|
||||
| Test questions | essay | Essay type question | Write about whatever you want |
|
||||
And I am on the "C1" "Course" page logged in as "teacher1"
|
||||
And I navigate to "Question banks" in current page administration
|
||||
And I click on "Qbank 1" "link"
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "teacher1"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I should see "Unknown type question"
|
||||
And I should see "Truefalse type question"
|
||||
And I should see "Essay type question"
|
||||
|
||||
@@ -24,6 +24,7 @@ Feature: A teacher can delete questions in the question bank
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | essay | Test question to be deleted | Write about whatever you want |
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "teacher1"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
|
||||
@javascript
|
||||
Scenario: A question not used anywhere can really be deleted
|
||||
@@ -32,6 +33,7 @@ Feature: A teacher can delete questions in the question bank
|
||||
And I apply question bank filter "Show hidden questions" with value "Yes"
|
||||
Then I should not see "Test question to be deleted"
|
||||
|
||||
@javascript
|
||||
Scenario: Deleting a question can be cancelled
|
||||
When I choose "Delete" action for "Test question to be deleted" in the question bank
|
||||
And I press "Cancel"
|
||||
@@ -53,6 +55,7 @@ Feature: A teacher can delete questions in the question bank
|
||||
| question | page | requireprevious |
|
||||
| Test used question to be deleted | 1 | 0 |
|
||||
When I am on the "Qbank 1" "core_question > question bank" page
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
And I choose "Delete" action for "Test used question to be deleted" in the question bank
|
||||
And I should see "This will delete the following question and all its versions:"
|
||||
And I should see "* Denotes questions which can't be deleted because they are in use. Instead, they will be hidden in the question bank unless you set 'Show hidden questions' to 'Yes'."
|
||||
@@ -77,7 +80,6 @@ Feature: A teacher can delete questions in the question bank
|
||||
|
||||
@javascript
|
||||
Scenario: Delete question has multiple versions in question bank page
|
||||
Given I am on the "Qbank 1" "core_question > question bank" page logged in as "teacher1"
|
||||
When the following "core_question > updated questions" exist:
|
||||
| questioncategory | question | questiontext |
|
||||
| Test questions | Test question to be deleted | Test question to be deleted version 2 |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@core @core_question
|
||||
@core @core_question @javascript
|
||||
Feature: A teacher can duplicate questions in the question bank
|
||||
In order to efficiently expand my question bank
|
||||
As a teacher
|
||||
@@ -24,6 +24,7 @@ Feature: A teacher can duplicate questions in the question bank
|
||||
| questioncategory | qtype | name | questiontext | idnumber |
|
||||
| Test questions | essay | Test question to be copied | Write about whatever you want | qid |
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "teacher"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
|
||||
Scenario: Duplicating a previously created question
|
||||
When I choose "Duplicate" action for "Test question to be copied" in the question bank
|
||||
@@ -40,7 +41,6 @@ Feature: A teacher can duplicate questions in the question bank
|
||||
When I choose "Duplicate" action for "Test question to be copied" in the question bank
|
||||
Then the field "Question name" matches value "Test question to be copied (copy)"
|
||||
|
||||
@javascript
|
||||
Scenario: The duplicate operation can be cancelled
|
||||
When I choose "Duplicate" action for "Test question to be copied" in the question bank
|
||||
And I press "Cancel"
|
||||
|
||||
@@ -24,6 +24,7 @@ Feature: A teacher can manage tags on questions in the question bank
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | essay | Test question to be tagged | Write about whatever you want |
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "teacher1"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
|
||||
@javascript
|
||||
Scenario: Manage tags on a question
|
||||
|
||||
@@ -26,16 +26,16 @@ Feature: Questions in the question bank have versions
|
||||
And quiz "Quiz 1" contains the following questions:
|
||||
| question | page |
|
||||
| First question | 1 |
|
||||
And I am on the "Quiz 1" "mod_quiz > question bank" page logged in as "teacher1"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
|
||||
@javascript
|
||||
Scenario: Question version is displayed
|
||||
Given I am on the "Quiz 1" "mod_quiz > question bank" page logged in as "teacher1"
|
||||
When I choose "Edit question" action for "First question" in the question bank
|
||||
Then I should see "v1 (latest)"
|
||||
|
||||
@javascript
|
||||
Scenario: Question version change when question is altered
|
||||
Given I am on the "Quiz 1" "mod_quiz > question bank" page logged in as "teacher1"
|
||||
When I choose "Edit question" action for "First question" in the question bank
|
||||
And I should see "v1 (latest)"
|
||||
When I set the field "id_name" to "Renamed question v2"
|
||||
|
||||
@@ -24,6 +24,7 @@ Feature: A teacher can edit questions in the question bank
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | essay | Test question to be edited | Write about whatever you want |
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "teacher1"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
|
||||
@javascript
|
||||
Scenario: Edit a previously created question
|
||||
@@ -68,6 +69,7 @@ Feature: A teacher can edit questions in the question bank
|
||||
When I am on the "Test question to be edited" "core_question > edit" page logged in as "teacher1"
|
||||
And I set the field "Question name" to "Edited question name"
|
||||
And I press "Cancel"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
Then I should see "Test question to be edited"
|
||||
And I should see "Admin User"
|
||||
|
||||
@@ -76,6 +78,7 @@ Feature: A teacher can edit questions in the question bank
|
||||
| questioncategory | qtype | name | idnumber |
|
||||
| Test questions | essay | Question with idnumber | frog |
|
||||
When I am on the "Qbank 1" "core_question > question bank" page logged in as "teacher1"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
Then I should see "frog" in the "Question with idnumber" "table_row"
|
||||
When I choose "Edit question" action for "Question with idnumber" in the question bank
|
||||
And I set the field "ID number" to ""
|
||||
@@ -87,6 +90,7 @@ Feature: A teacher can edit questions in the question bank
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | missingtype | Broken question | Write something |
|
||||
When I am on the "Qbank 1" "core_question > question bank" page logged in as "teacher1"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
Then the "Edit question" item should not exist in the "Edit" action menu of the "Broken question" "table_row"
|
||||
And the "Duplicate" item should not exist in the "Edit" action menu of the "Broken question" "table_row"
|
||||
And the "Preview" item should not exist in the "Edit" action menu of the "Broken question" "table_row"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@core @core_question @qbank_filter @javascript
|
||||
Feature: A teacher can pagimate through question bank questions
|
||||
Feature: A teacher can paginate through question bank questions
|
||||
In order to paginate questions
|
||||
As a teacher
|
||||
I must be able to paginate
|
||||
@@ -19,7 +19,7 @@ Feature: A teacher can pagimate through question bank questions
|
||||
| qbank | Qbank 1 | Question bank 1 | C1 | qbank1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | questioncategory | name |
|
||||
| Activity module | qbank1 | Top | Used category |
|
||||
| Activity module | qbank1 | top | Used category |
|
||||
Given 100 "questions" exist with the following data:
|
||||
| questioncategory | Used category |
|
||||
| qtype | essay |
|
||||
@@ -32,6 +32,8 @@ Feature: A teacher can pagimate through question bank questions
|
||||
Scenario: Questions can be paginated
|
||||
Given I am on the "Qbank 1" "core_question > question bank" page logged in as "teacher1"
|
||||
When I apply question bank filter "Category" with value "Top for Qbank 1"
|
||||
And I set the field "Also show questions from subcategories" to "1"
|
||||
And I press "Apply filters"
|
||||
And I follow "Sort by Question name ascending"
|
||||
And I follow "Sort by Question name descending"
|
||||
And I should see "Tests question 1"
|
||||
|
||||
@@ -26,6 +26,7 @@ Feature: The questions in the question bank can be selected in various ways
|
||||
| Test questions | essay | B question 2 name | teacher1 | Question 2 text |
|
||||
| Test questions | numerical | C question 3 name | teacher1 | Question 3 text |
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "teacher1"
|
||||
And I apply question bank filter "Category" with value "Test questions"
|
||||
|
||||
@javascript
|
||||
Scenario: The question text can be chosen all in the list of questions
|
||||
|
||||
@@ -17,14 +17,11 @@ Feature: The questions in the question bank can be sorted in various ways
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| qbank | Qbank 1 | Question bank 1 | C1 | qbank1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | qbank1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | user | questiontext | idnumber |
|
||||
| Test questions | essay | A question 1 name | admin | Question 1 text | numidnum</a |
|
||||
| Test questions | essay | B question 2 name | teacher1 | Question 2 text | |
|
||||
| Test questions | numerical | C question 3 name | teacher1 | Question 3 text | numidnum</c |
|
||||
| questioncategory | qtype | name | user | questiontext | idnumber |
|
||||
| Default for Qbank 1 | essay | A question 1 name | admin | Question 1 text | numidnum</a |
|
||||
| Default for Qbank 1 | essay | B question 2 name | teacher1 | Question 2 text | |
|
||||
| Default for Qbank 1 | numerical | C question 3 name | teacher1 | Question 3 text | numidnum</c |
|
||||
And I am on the "Qbank 1" "core_question > question bank" page logged in as "teacher1"
|
||||
|
||||
Scenario: The questions are sorted by type by default
|
||||
|
||||
@@ -538,7 +538,7 @@ final class category_manager_test extends \advanced_testcase {
|
||||
$quiz = $this->getDataGenerator()->create_module('quiz', ['course' => $course->id]);
|
||||
$context = \context_module::instance($quiz->cmid);
|
||||
$questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
||||
$qcategory1 = $questiongenerator->create_question_category(['contextid' => $context->id]);
|
||||
$qcategory1 = question_get_default_category($context->id);
|
||||
|
||||
// Try to delete an only child of top category having also at least one child.
|
||||
$this->expectException('moodle_exception');
|
||||
@@ -591,15 +591,15 @@ final class category_manager_test extends \advanced_testcase {
|
||||
$context = \context_module::instance($quiz->cmid);
|
||||
$questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
||||
$topcategory = question_get_top_category($context->id, true);
|
||||
$qcategory1 = $questiongenerator->create_question_category(['contextid' => $context->id]);
|
||||
$this->assertEquals(1, $manager->get_max_sortorder($topcategory->id));
|
||||
$qcategory1 = question_get_default_category($context->id);
|
||||
$this->assertEquals(999, $manager->get_max_sortorder($topcategory->id));
|
||||
|
||||
$qcategory2 = $questiongenerator->create_question_category(['contextid' => $context->id, 'parent' => $qcategory1->id]);
|
||||
|
||||
$this->assertEquals(1, $manager->get_max_sortorder($qcategory1->id));
|
||||
|
||||
$questiongenerator->create_question_category(['contextid' => $context->id]);
|
||||
$this->assertEquals(2, $manager->get_max_sortorder($topcategory->id));
|
||||
$this->assertEquals(1000, $manager->get_max_sortorder($topcategory->id));
|
||||
|
||||
$this->assertEquals(0, $manager->get_max_sortorder($qcategory2->id));
|
||||
$questiongenerator->create_question_category(['contextid' => $context->id, 'parent' => $qcategory2->id]);
|
||||
|
||||
@@ -41,8 +41,8 @@ final class generator_test extends \advanced_testcase {
|
||||
$count = $DB->count_records('question_categories');
|
||||
|
||||
$cat = $generator->create_question_category();
|
||||
$count += $count ? 1 : 2; // Calling $generator->create_question_category() for the first time
|
||||
// creates a Top category as well.
|
||||
$count += $count ? 1 : 3; // Calling $generator->create_question_category() for the first time
|
||||
// creates a Top and Default category as well.
|
||||
$this->assertEquals($count, $DB->count_records('question_categories'));
|
||||
|
||||
$cat = $generator->create_question_category(['name' => 'My category', 'sortorder' => 1]);
|
||||
|
||||
@@ -83,7 +83,7 @@ final class question_bank_helper_test extends \advanced_testcase {
|
||||
|
||||
$sharedmod1 = $sharedmodgen->create_instance(['course' => $course1]);
|
||||
$sharedmod1context = \context_module::instance($sharedmod1->cmid);
|
||||
$sharedmod1qcat1 = $qgen->create_question_category(['contextid' => $sharedmod1context->id]);
|
||||
$sharedmod1qcat1 = question_get_default_category($sharedmod1context->id);
|
||||
$sharedmod1qcat2 = $qgen->create_question_category(['contextid' => $sharedmod1context->id]);
|
||||
$sharedmod1qcat2child = $qgen->create_question_category([
|
||||
'contextid' => $sharedmod1context->id,
|
||||
@@ -92,13 +92,13 @@ final class question_bank_helper_test extends \advanced_testcase {
|
||||
]);
|
||||
$privatemod1 = $privatemodgen->create_instance(['course' => $course1]);
|
||||
$privatemod1context = \context_module::instance($privatemod1->cmid);
|
||||
$privatemod1qcat1 = $qgen->create_question_category(['contextid' => $privatemod1context->id]);
|
||||
$privatemod1qcat1 = question_get_default_category($privatemod1context->id);
|
||||
role_assign($roles['editingteacher']->id, $user->id, \context_module::instance($sharedmod1->cmid));
|
||||
role_assign($roles['editingteacher']->id, $user->id, \context_module::instance($privatemod1->cmid));
|
||||
|
||||
$sharedmod2 = $sharedmodgen->create_instance(['course' => $course2]);
|
||||
$sharedmod2context = \context_module::instance($sharedmod2->cmid);
|
||||
$sharedmod2qcat1 = $qgen->create_question_category(['contextid' => $sharedmod2context->id]);
|
||||
$sharedmod2qcat1 = question_get_default_category($sharedmod2context->id);
|
||||
$sharedmod2qcat2 = $qgen->create_question_category(['contextid' => $sharedmod2context->id]);
|
||||
$sharedmod2qcat2child = $qgen->create_question_category([
|
||||
'contextid' => $sharedmod2context->id,
|
||||
@@ -106,7 +106,7 @@ final class question_bank_helper_test extends \advanced_testcase {
|
||||
]);
|
||||
$privatemod2 = $privatemodgen->create_instance(['course' => $course2]);
|
||||
$privatemod2context = \context_module::instance($privatemod2->cmid);
|
||||
$privatemod1qcat1 = $qgen->create_question_category(['contextid' => $privatemod2context->id]);
|
||||
$privatemod1qcat1 = question_get_default_category($privatemod2context->id);
|
||||
role_assign($roles['editingteacher']->id, $user->id, \context_module::instance($sharedmod2->cmid));
|
||||
role_assign($roles['editingteacher']->id, $user->id, \context_module::instance($privatemod2->cmid));
|
||||
|
||||
|
||||
@@ -17,13 +17,10 @@ Feature: Questions with invalid types should be clear and any actions which won'
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| qbank | Qbank 1 | Question bank 1 | C1 | qbank1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | qbank1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | user | questiontext |
|
||||
| Test questions | essay | Question 1 | teacher1 | A text |
|
||||
| Test questions | essay | Question 2 | teacher1 | B text |
|
||||
| questioncategory | qtype | name | user | questiontext |
|
||||
| Default for Qbank 1 | essay | Question 1 | teacher1 | A text |
|
||||
| Default for Qbank 1 | essay | Question 2 | teacher1 | B text |
|
||||
And question "Question 2" is changed to simulate being of an uninstalled type
|
||||
|
||||
Scenario: Questions of invalid types should be highlighted and labelled as invalid
|
||||
|
||||
@@ -14,13 +14,10 @@ Feature: A Teacher can generate question instance reports
|
||||
And the following "activities" exist:
|
||||
| activity | course | name |
|
||||
| quiz | C1 | Test quiz Q001 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | Test quiz Q001 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name |
|
||||
| Test questions | truefalse | TF |
|
||||
| Test questions | shortanswer | SA |
|
||||
| questioncategory | qtype | name |
|
||||
| Default for Test quiz Q001 | truefalse | TF |
|
||||
| Default for Test quiz Q001 | shortanswer | SA |
|
||||
And quiz "Test quiz Q001" contains the following questions:
|
||||
| question | page | maxmark |
|
||||
| TF | 1 | 5.0 |
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2025082900.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2025082900.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
$release = '5.1dev+ (Build: 20250829)'; // Human-friendly version name
|
||||
|
||||
Reference in New Issue
Block a user