Merge branch 'MDL-61556-master' of git://github.com/rezaies/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2018-03-07 00:13:01 +01:00
2 changed files with 37 additions and 1 deletions
+5 -1
View File
@@ -76,8 +76,12 @@ if ($param->moveupcontext || $param->movedowncontext) {
} else {
$catid = $param->movedowncontext;
}
$newtopcat = question_get_top_category($param->tocontext);
if (!$newtopcat) {
print_error('invalidcontext');
}
$oldcat = $DB->get_record('question_categories', array('id' => $catid), '*', MUST_EXIST);
$qcobject->update_category($catid, '0,'.$param->tocontext, $oldcat->name, $oldcat->info);
$qcobject->update_category($catid, "{$newtopcat->id},{$param->tocontext}", $oldcat->name, $oldcat->info);
// The previous line does a redirect().
}
@@ -0,0 +1,32 @@
@core @core_question
Feature: A teacher can move question categories in the question bank
In order to organize my questions
As a teacher
I create question categories and move them in the question bank
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | course | idnumber |
| quiz | Test quiz | C1 | quiz1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
@javascript
Scenario: A question category can be moved to another context
When I follow "Test quiz"
And I navigate to "Categories" in current page administration
And I click on "Parent category" "field"
And I click on "//optgroup[@label='Quiz: Test quiz']//option[normalize-space(text())='Top']" "xpath_element"
And I set the field "Name" to "Test category"
And I press "submitbutton"
And I click on "Share in context for Course: Course 1" "link" in the "Test category" "list_item"
Then I should see "Test category" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' questioncategories ') and contains(concat(' ', normalize-space(@class), ' '), ' contextlevel50 ')]" "xpath_element"