Merge branch 'MDL-79540_405_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_405_STABLE

This commit is contained in:
Mihail Geshoski
2025-08-07 10:19:19 +08:00
2 changed files with 22 additions and 1 deletions
@@ -168,7 +168,8 @@ class helper {
// Recursively indent the children.
foreach ($categories[$id]->childids as $childid) {
if ($childid != $nochildrenof) {
[$childcategory, ] = explode(',', $childid);
if ($childcategory != $nochildrenof) {
$newcategories = $newcategories + self::flatten_category_tree(
$categories,
$childid,
@@ -99,3 +99,23 @@ Feature: A teacher can reorder question categories
And I choose "Move" in the open action menu
And I click on "After Course category 1" "link" in the "Move Course category 2" "dialogue"
And I should see "ID number already in use. Change it to move or update category."
Scenario: Teacher can move a category via the edit form
Given "Course category 1" "list_item" should appear before "Course category 2" "list_item"
And "Course category 2" "list_item" should appear before "Course category 3" "list_item"
When I open the action menu in "Course category 3" "list_item"
And I choose "Edit" in the open action menu
And I should see "Top for Course 1" in the "Parent category" "select"
And I should see "Course category 1" in the "Parent category" "field"
And I should see "Course category 2" in the "Parent category" "field"
And I should not see "Course category 3" in the "Parent category" "field"
And I set the field "Parent category" to "Course category 1"
And I press "Save changes"
Then "Course category 1" "list_item" should appear before "Course category 3" "list_item"
And "Course category 3" "list_item" should appear before "Course category 2" "list_item"
And I open the action menu in "Course category 1" "list_item"
And I choose "Edit" in the open action menu
And I should see "Top for Course 1" in the "Parent category" "select"
And I should not see "Course category 1" in the "Parent category" "field"
And I should see "Course category 2" in the "Parent category" "field"
And I should not see "Course category 3" in the "Parent category" "field"