Merge branch 'MDL-84341_404' of https://github.com/cwarwicker/moodle into MOODLE_404_STABLE
This commit is contained in:
@@ -97,18 +97,9 @@ class question_history_view extends view {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default sort for question data.
|
||||
* @return array
|
||||
*/
|
||||
#[\Override]
|
||||
protected function default_sort(): array {
|
||||
$defaultsort = [];
|
||||
if (class_exists('\\qbank_viewcreator\\creator_name_column')) {
|
||||
$sort = 'qbank_viewcreator\creator_name_column-timecreated';
|
||||
}
|
||||
$defaultsort[$sort] = 1;
|
||||
|
||||
return $defaultsort;
|
||||
return ['qbank_history__version_number_column' => 1];
|
||||
}
|
||||
|
||||
protected function build_query(): void {
|
||||
|
||||
@@ -44,4 +44,9 @@ class version_number_column extends column_base {
|
||||
return ['pr-3'];
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function is_sortable() {
|
||||
return 'qv.version';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@qbank @qbank_history
|
||||
@qbank @qbank_history @javascript
|
||||
Feature: Use the qbank plugin manager page for version column
|
||||
In order to check the plugin behaviour with enable and disable
|
||||
|
||||
@@ -10,11 +10,16 @@ Feature: Use the qbank plugin manager page for version column
|
||||
| activity | name | course | idnumber |
|
||||
| quiz | Test quiz | C1 | quiz1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Course | C1 | Test questions |
|
||||
| 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 |
|
||||
| Test questions | truefalse | First Question |
|
||||
And the following "core_question > updated questions" exist:
|
||||
| questioncategory | question | name |
|
||||
| Test questions | First Question | First Edit |
|
||||
| Test questions | First Question | Edit the Second |
|
||||
| Test questions | First Question | The Final Edit |
|
||||
|
||||
Scenario: Enable/disable version column from the base view
|
||||
Given I log in as "admin"
|
||||
@@ -22,8 +27,26 @@ Feature: Use the qbank plugin manager page for version column
|
||||
And I should see "Question history"
|
||||
When I click on "Disable" "link" in the "Question history" "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 I should not see "Version" in the "region-main" "region"
|
||||
And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
|
||||
And I click on "Enable" "link" in the "Question history" "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 should see "Version" in the "region-main" "region"
|
||||
|
||||
Scenario: Sort the question versions
|
||||
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 choose "History" action for "The Final Edit" in the question bank
|
||||
Then "Edit the Second" "checkbox" should appear before "The Final Edit" "checkbox"
|
||||
Then "First Edit" "checkbox" should appear before "Edit the Second" "checkbox"
|
||||
Then "First Question" "checkbox" should appear before "First Edit" "checkbox"
|
||||
And I follow "Sort by Version ascending"
|
||||
Then "Edit the Second" "checkbox" should appear before "The Final Edit" "checkbox"
|
||||
Then "First Edit" "checkbox" should appear before "Edit the Second" "checkbox"
|
||||
Then "First Question" "checkbox" should appear before "First Edit" "checkbox"
|
||||
And I follow "Sort by Version descending"
|
||||
Then "The Final Edit" "checkbox" should appear before "Edit the Second" "checkbox"
|
||||
Then "Edit the Second" "checkbox" should appear before "First Edit" "checkbox"
|
||||
Then "First Edit" "checkbox" should appear before "First Question" "checkbox"
|
||||
|
||||
@@ -76,10 +76,10 @@ class behat_core_question_generator extends behat_generator_base {
|
||||
protected function process_updated_question(array $data): void {
|
||||
global $DB;
|
||||
$question = $DB->get_record('question', ['id' => $data['id']], '*', MUST_EXIST);
|
||||
$overrides = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$question->{$key} = $value;
|
||||
$overrides[$key] = $value;
|
||||
}
|
||||
|
||||
$this->datagenerator->get_plugin_generator('core_question')->update_question($question);
|
||||
$this->datagenerator->get_plugin_generator('core_question')->update_question($question, null, $overrides);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user