diff --git a/course/management.php b/course/management.php index ecdee05bce3..87d6fc4d7c5 100644 --- a/course/management.php +++ b/course/management.php @@ -69,11 +69,8 @@ if ($courseid) { } else { $course = null; $courseid = null; - $category = null; - $categoryid = null; - if ($viewmode === 'default') { - $viewmode = 'categories'; - } + $category = coursecat::get_default(); + $categoryid = $category->id; $context = $systemcontext; } diff --git a/course/tests/behat/behat_course.php b/course/tests/behat/behat_course.php index a306319a45b..7698fe75603 100644 --- a/course/tests/behat/behat_course.php +++ b/course/tests/behat/behat_course.php @@ -1443,7 +1443,7 @@ class behat_course extends behat_base { break; case "Course categories": $return[] = new Given('"#category-listing" "css_element" should exist'); - $return[] = new Given('"#course-listing" "css_element" should not exist'); + $return[] = new Given('"#course-listing" "css_element" should exist'); break; case "Courses categories and courses": default: diff --git a/course/tests/behat/category_change_visibility.feature b/course/tests/behat/category_change_visibility.feature index b4f13b21a04..ceccb9eaa70 100644 --- a/course/tests/behat/category_change_visibility.feature +++ b/course/tests/behat/category_change_visibility.feature @@ -15,7 +15,7 @@ Feature: We can change the visibility of categories in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see "Cat 1" in the "#category-listing ul.ml" "css_element" And category in management listing should be visible "CAT1" And I toggle visibility of category "CAT1" in management listing @@ -36,7 +36,7 @@ Feature: We can change the visibility of categories in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see "Cat 1" in the "#category-listing ul.ml" "css_element" And category in management listing should be visible "CAT1" And I toggle visibility of category "CAT1" in management listing @@ -55,7 +55,7 @@ Feature: We can change the visibility of categories in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see "Cat 1" in the "#category-listing ul.ml" "css_element" And I should not see "Cat 2" in the "#category-listing ul.ml" "css_element" And category in management listing should be visible "CAT1" @@ -91,7 +91,7 @@ Feature: We can change the visibility of categories in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see "Cat 1" in the "#category-listing ul.ml" "css_element" And I should not see "Cat 2" in the "#category-listing ul.ml" "css_element" And category in management listing should be visible "CAT1" @@ -124,7 +124,7 @@ Feature: We can change the visibility of categories in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect. And I should see the "Course categories and courses" management page @@ -199,7 +199,7 @@ Feature: We can change the visibility of categories in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect. And I should see the "Course categories and courses" management page @@ -264,7 +264,7 @@ Feature: We can change the visibility of categories in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect And I should see the "Course categories and courses" management page diff --git a/course/tests/behat/category_management.feature b/course/tests/behat/category_management.feature index 63e00d42c8c..b90a8f8f639 100644 --- a/course/tests/behat/category_management.feature +++ b/course/tests/behat/category_management.feature @@ -21,7 +21,7 @@ Feature: Test category management actions And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "edit" action for "Cat 1" in management category listing # Redirect And I should see "Edit category settings" @@ -55,7 +55,7 @@ Feature: Test category management actions And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see "Cat 1" in the "#category-listing ul.ml" "css_element" And I should see "Cat 2" in the "#category-listing ul.ml" "css_element" And I should see "Cat 3" in the "#category-listing ul.ml" "css_element" @@ -81,7 +81,7 @@ Feature: Test category management actions And I should see "Deleted course category Cat 2" And I press "Continue" # Redirect - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see "Cat 1" in the "#category-listing ul.ml" "css_element" And I should not see "Cat 2" in the "#category-listing ul.ml" "css_element" And I should see "Cat 3" in the "#category-listing ul.ml" "css_element" @@ -113,7 +113,7 @@ Feature: Test category management actions And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "assignroles" action for "Cat 1" in management category listing # Redirect And I should see "Assign roles in Category: Cat 1" @@ -133,7 +133,7 @@ Feature: Test category management actions And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "permissions" action for "Cat 1" in management category listing # Redirect And I should see "Permissions in Category: Cat 1" @@ -152,7 +152,7 @@ Feature: Test category management actions And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "cohorts" action for "Cat 1" in management category listing # Redirect And I should see "Category: Cat 1: available cohorts" @@ -167,7 +167,7 @@ Feature: Test category management actions And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "filters" action for "Cat 1" in management category listing # Redirect And I should see "Filter settings in Category: Cat 1" @@ -183,11 +183,12 @@ Feature: Test category management actions | Cat 1 | 0 | CAT1 | And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "Create new category" "link" in the ".category-listing-actions" "css_element" # Redirect. And I should see "Add new category" And I set the following fields to these values: + | Parent category | Top | | Category name | Test category 2 | | Category ID number | TC2 | And I press "Create category" @@ -200,6 +201,7 @@ Feature: Test category management actions # Redirect And I should see "Add new category" And I set the following fields to these values: + | Parent category | Top | | Category name | Test category 3 | | Category ID number | TC3 | And I press "Create category" @@ -219,7 +221,7 @@ Feature: Test category management actions And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see "Cat 1" in the "#category-listing ul.ml" "css_element" And I should see "Cat 2" in the "#category-listing ul.ml" "css_element" And I should see "Cat 3" in the "#category-listing ul.ml" "css_element" @@ -250,7 +252,7 @@ Feature: Test category management actions And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see "Cat 1" in the "#category-listing ul.ml" "css_element" And I should see "Cat 2" in the "#category-listing ul.ml" "css_element" And I should see "Cat 3" in the "#category-listing ul.ml" "css_element" diff --git a/course/tests/behat/category_resort.feature b/course/tests/behat/category_resort.feature index ddbb4236819..01d6857466d 100644 --- a/course/tests/behat/category_resort.feature +++ b/course/tests/behat/category_resort.feature @@ -14,12 +14,12 @@ Feature: Test we can resort categories in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I set the field "menuselectsortby" to "All categories" And I set the field "menuresortcategoriesby" to <sortby> And I press "Sort" # Redirect. - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see category listing <cat1> before <cat2> And I should see category listing <cat2> before <cat3> @@ -38,7 +38,7 @@ Feature: Test we can resort categories in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "Test category" "link" # Redirect. And I should see the "Course categories and courses" management page @@ -65,7 +65,7 @@ Feature: Test we can resort categories in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "Master cat" "link" # Redirect. And I should see the "Course categories and courses" management page @@ -91,7 +91,7 @@ Feature: Test we can resort categories in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "Master cat" category in the management category listing # Redirect. And I should see the "Course categories and courses" management page @@ -118,7 +118,7 @@ Feature: Test we can resort categories in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect. We should a 1, 1a, 1b, 1c, 2. And I should see the "Course categories and courses" management page @@ -178,7 +178,7 @@ Feature: Test we can resort categories in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect. And I should see the "Course categories and courses" management page diff --git a/course/tests/behat/course_category_management_listing.feature b/course/tests/behat/course_category_management_listing.feature index 295f4b3f010..818619b57ff 100644 --- a/course/tests/behat/course_category_management_listing.feature +++ b/course/tests/behat/course_category_management_listing.feature @@ -14,7 +14,7 @@ Feature: Course category management interface performs as expected And I should see "Course and category management" in the "h2" "css_element" And I should see "Course categories" in the ".view-mode-selector" "css_element" And I should see "Course categories" in the "h3" "css_element" - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page @javascript Scenario: Test view mode functionality @@ -27,7 +27,7 @@ Feature: Course category management interface performs as expected And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see "Course categories" in the "#category-listing h3" "css_element" And I should see "Cat 1" in the "#category-listing" "css_element" And I should see "Course categories" in the ".view-mode-selector" "css_element" @@ -42,9 +42,9 @@ Feature: Course category management interface performs as expected # Redirect. And I should see the "Course categories and courses" management page And I should see "Course categories" in the "#category-listing h3" "css_element" - And I should see "Courses" in the "#course-listing h3" "css_element" + And I should see "Miscellaneous" in the "#course-listing h3" "css_element" And I should see "Cat 1" in the "#category-listing" "css_element" - And I should see "Please select a category" in the "#course-listing" "css_element" + And I should see "No courses in this category" in the "#course-listing" "css_element" And I click on category "Cat 1" in the management interface # Redirect. And I should see the "Course categories and courses" management page @@ -94,7 +94,7 @@ Feature: Course category management interface performs as expected And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element" And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element" And I should not see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element" @@ -164,7 +164,7 @@ Feature: Course category management interface performs as expected And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element" And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element" And I should not see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element" @@ -244,12 +244,12 @@ Feature: Course category management interface performs as expected And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I set the field "menuselectsortby" to "All categories" And I set the field "menuresortcategoriesby" to <sortby> And I press "Sort" # Redirect. - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see category listing <cat1> before <cat2> And I should see category listing <cat2> before <cat3> @@ -269,7 +269,7 @@ Feature: Course category management interface performs as expected And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "Master cat" category in the management category listing # Redirect. And I should see the "Course categories and courses" management page @@ -297,7 +297,7 @@ Feature: Course category management interface performs as expected And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "Cat 1" "link" # Redirect. And I should see the "Course categories and courses" management page @@ -339,7 +339,7 @@ Feature: Course category management interface performs as expected And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "Cat 1" "link" # Redirect. And I should see the "Course categories and courses" management page @@ -522,7 +522,7 @@ Feature: Course category management interface performs as expected | CAT1 | Course 5 | Course 5 | C5 | And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "Cat 1" "link" # Redirect. And I should see the "Course categories and courses" management page @@ -587,7 +587,7 @@ Feature: Course category management interface performs as expected And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on "Cat 1" "link" # Redirect. And I should see the "Course categories and courses" management page @@ -681,7 +681,7 @@ Feature: Course category management interface performs as expected And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface And I click on "edit" action for "Course 1" in management course listing # Redirect @@ -706,7 +706,7 @@ Feature: Course category management interface performs as expected And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element" And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element" And I should not see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element" @@ -764,7 +764,7 @@ Feature: Course category management interface performs as expected And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I should see "Cat A (1)" in the "#course-category-listings ul.ml" "css_element" And I should see "Cat B (2)" in the "#course-category-listings ul.ml" "css_element" And I should not see "Cat C (1-1)" in the "#course-category-listings ul.ml" "css_element" diff --git a/course/tests/behat/course_change_visibility.feature b/course/tests/behat/course_change_visibility.feature index 2230ddea568..eedf9843920 100644 --- a/course/tests/behat/course_change_visibility.feature +++ b/course/tests/behat/course_change_visibility.feature @@ -15,7 +15,7 @@ Feature: We can change the visibility of courses in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect. And I should see the "Course categories and courses" management page @@ -62,7 +62,7 @@ Feature: We can change the visibility of courses in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect. And I should see the "Course categories and courses" management page diff --git a/course/tests/behat/course_resort.feature b/course/tests/behat/course_resort.feature index 678bc4fb9a5..b530e5b633a 100644 --- a/course/tests/behat/course_resort.feature +++ b/course/tests/behat/course_resort.feature @@ -17,7 +17,7 @@ Feature: Test we can resort course in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect. And I should see the "Course categories and courses" management page @@ -50,7 +50,7 @@ Feature: Test we can resort course in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect. And I should see the "Course categories and courses" management page @@ -86,7 +86,7 @@ Feature: Test we can resort course in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect. And I should see the "Course categories and courses" management page @@ -123,7 +123,7 @@ Feature: Test we can resort course in the management interface. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect. And I should see the "Course categories and courses" management page diff --git a/course/tests/behat/create_delete_course.feature b/course/tests/behat/create_delete_course.feature index c12ae95afbb..2cff137f052 100644 --- a/course/tests/behat/create_delete_course.feature +++ b/course/tests/behat/create_delete_course.feature @@ -11,7 +11,7 @@ Feature: Test we can both create and delete a course. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect And I should see the "Course categories and courses" management page @@ -26,7 +26,7 @@ Feature: Test we can both create and delete a course. And I press "Save changes" # Redirect And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect And I should see the "Course categories and courses" management page @@ -44,7 +44,7 @@ Feature: Test we can both create and delete a course. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect And I should see the "Course categories and courses" management page @@ -76,7 +76,7 @@ Feature: Test we can both create and delete a course. And I log in as "admin" And I go to the courses management page - And I should see the "Course categories" management page + And I should see the "Course categories and courses" management page And I click on category "Cat 1" in the management interface # Redirect And I should see the "Course categories and courses" management page