Skip to content

Commit

Permalink
Merge branch 'MDL-72115-master' of git://github.com/sarjona/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Sep 14, 2021
2 parents 9049ec5 + 3f2f2e8 commit 2d65b1e
Show file tree
Hide file tree
Showing 46 changed files with 213 additions and 189 deletions.
2 changes: 1 addition & 1 deletion admin/tool/behat/tests/behat/data_generators.feature
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Feature: Set up contextual data for tests
And I should see "Course 2"
And I follow "Cat 2"
And I should see "No courses in this category"
And I follow "Miscellaneous"
And I follow "Category 1"
And I should see "Course 3"

@javascript
Expand Down
22 changes: 11 additions & 11 deletions admin/tool/capability/tests/behat/show_contexts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: Show capabilities for multiple contexts
| Roles: | Student |
And I click on "Get the overview" "button"
Then I should see "Permissions in System"
And I should see "Permissions in Category: Miscellaneous"
And I should see "Permissions in Category: Category 1"
And I should see "Permissions in Course: Course 1"
And I should not see "Permissions in Course: Course 2"

Expand All @@ -32,7 +32,7 @@ Feature: Show capabilities for multiple contexts
| Roles: | Student |
And I click on "Get the overview" "button"
Then I should see "Permissions in System"
And I should not see "Permissions in Category: Miscellaneous"
And I should not see "Permissions in Category: Category 1"
And I should not see "Permissions in Course: Course 1"
And I should not see "Permissions in Course: Course 2"

Expand All @@ -42,7 +42,7 @@ Feature: Show capabilities for multiple contexts
| Roles: | Student |
And I click on "Get the overview" "button"
Then I should see "Permissions in System"
And I should see "Permissions in Category: Miscellaneous"
And I should see "Permissions in Category: Category 1"
And I should see "Permissions in Course: Course 1"
And I should not see "Permissions in Course: Course 2"

Expand All @@ -52,7 +52,7 @@ Feature: Show capabilities for multiple contexts
| Roles: | Student |
And I click on "Get the overview" "button"
Then I should see "Permissions in System"
And I should see "Permissions in Category: Miscellaneous"
And I should see "Permissions in Category: Category 1"
And I should see "Permissions in Course: Course 1"
And I should not see "Permissions in Course: Course 2"

Expand All @@ -62,7 +62,7 @@ Feature: Show capabilities for multiple contexts
| Roles: | Student |
And I click on "Get the overview" "button"
Then I should see "Permissions in System"
And I should not see "Permissions in Category: Miscellaneous"
And I should not see "Permissions in Category: Category 1"
And I should not see "Permissions in Course: Course 1"
And I should not see "Permissions in Course: Course 2"

Expand All @@ -72,7 +72,7 @@ Feature: Show capabilities for multiple contexts
| Roles: | |
And I click on "Get the overview" "button"
Then I should see "Permissions in System"
And I should see "Permissions in Category: Miscellaneous"
And I should see "Permissions in Category: Category 1"
And I should see "Permissions in Course: Course 1"
And I should not see "Permissions in Course: Course 2"

Expand All @@ -82,7 +82,7 @@ Feature: Show capabilities for multiple contexts
| Roles: | |
And I click on "Get the overview" "button"
Then I should see "Permissions in System"
And I should not see "Permissions in Category: Miscellaneous"
And I should not see "Permissions in Category: Category 1"
And I should not see "Permissions in Course: Course 1"
And I should not see "Permissions in Course: Course 2"

Expand All @@ -92,7 +92,7 @@ Feature: Show capabilities for multiple contexts
| Roles: | |
And I click on "Get the overview" "button"
Then I should see "Permissions in System"
And I should see "Permissions in Category: Miscellaneous"
And I should see "Permissions in Category: Category 1"
And I should see "Permissions in Course: Course 1"
And I should see "Permissions in Course: Course 2"

Expand All @@ -103,7 +103,7 @@ Feature: Show capabilities for multiple contexts
And I set the field "Show differences only" to "1"
And I click on "Get the overview" "button"
Then I should see "Permissions in System"
And I should see "Permissions in Category: Miscellaneous"
And I should see "Permissions in Category: Category 1"
And I should see "There are no differences to show between selected roles in this context"
And I should see "Permissions in Course: Course 1"
And I should not see "Permissions in Course: Course 2"
Expand All @@ -116,7 +116,7 @@ Feature: Show capabilities for multiple contexts
And I click on "Get the overview" "button"
Then I should see "Permissions in System"
And I should see "There are no differences to show between selected roles in this context"
And I should not see "Permissions in Category: Miscellaneous"
And I should not see "Permissions in Category: Category 1"
And I should not see "Permissions in Course: Course 1"
And I should not see "Permissions in Course: Course 2"

Expand All @@ -127,7 +127,7 @@ Feature: Show capabilities for multiple contexts
And I set the field "Show differences only" to "1"
And I click on "Get the overview" "button"
Then I should see "Permissions in System"
And I should see "Permissions in Category: Miscellaneous"
And I should see "Permissions in Category: Category 1"
And I should see "There are no differences to show between selected roles in this context"
And I should see "Permissions in Course: Course 1"
And I should not see "Permissions in Course: Course 2"
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Course cards should always show
"courseimage": "https://placekitten.com/300/500",
"fullname": "Mathematics Year One",
"isfavourite": true,
"coursecategory": "Miscellaneous",
"coursecategory": "Category 1",
"showcoursecategory": true,
"visible": true
}
Expand Down Expand Up @@ -71,7 +71,7 @@ The example below show a deck of cards as used on the starred courses block
"courseimage": "https://placekitten.com/300/500",
"fullname": "Mathematics Year One",
"isfavourite": true,
"coursecategory": "Miscellaneous",
"coursecategory": "Category 1",
"showcoursecategory": true,
"visible": true
},
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/moodlenet/templates/view-cards.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"viewurl": "https://moodlesite/course/view.php?id=2",
"courseimage": "https://moodlesite/pluginfile/123/course/overviewfiles/123.jpg",
"fullname": "course 3",
"coursecategory": "Miscellaneous",
"coursecategory": "Category 1",
"visible": true
}
]
Expand Down
6 changes: 5 additions & 1 deletion analytics/tests/manager_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,11 @@ public function test_get_potential_context_restrictions() {

$this->assertCount(1, \core_analytics\manager::get_potential_context_restrictions([CONTEXT_COURSECAT], 'Course category'));
$this->assertCount(1, \core_analytics\manager::get_potential_context_restrictions([CONTEXT_COURSECAT], 'Course category 1'));
$this->assertCount(1, \core_analytics\manager::get_potential_context_restrictions([CONTEXT_COURSECAT], 'Miscellaneous'));
$this->assertCount(
2,
\core_analytics\manager::get_potential_context_restrictions([CONTEXT_COURSECAT],
get_string('defaultcategoryname')
));
$this->assertCount(1, \core_analytics\manager::get_potential_context_restrictions([CONTEXT_COURSE], 'Test course 1'));
$this->assertCount(1, \core_analytics\manager::get_potential_context_restrictions([CONTEXT_COURSE], 'Test course'));
}
Expand Down
2 changes: 1 addition & 1 deletion analytics/tests/prediction_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function test_model_contexts() {
$this->resetAfterTest(true);
$this->setAdminuser();

$misc = $DB->get_record('course_categories', ['name' => 'Miscellaneous']);
$misc = $DB->get_record('course_categories', ['name' => get_string('defaultcategoryname')]);
$miscctx = \context_coursecat::instance($misc->id);

$category = $this->getDataGenerator()->create_category();
Expand Down
2 changes: 1 addition & 1 deletion backup/cc/sheets/course_header.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ID>1</ID>
<CATEGORY>
<ID>1</ID>
<NAME>Miscellaneous</NAME>
<NAME>Category 1</NAME>
</CATEGORY>
<PASSWORD></PASSWORD>
<FULLNAME>[#course_name#]</FULLNAME>
Expand Down
2 changes: 1 addition & 1 deletion backup/cc/sheets/moodle_blti_export.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@
<ID>2</ID>
<CATEGORY>
<ID>1</ID>
<NAME>Miscellaneous</NAME>
<NAME>Category 1</NAME>
</CATEGORY>
<PASSWORD></PASSWORD>
<FULLNAME>Course Fullname 101</FULLNAME>
Expand Down
2 changes: 1 addition & 1 deletion backup/converter/moodle1/tests/fixtures/moodle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<ID>33</ID>
<CATEGORY>
<ID>1</ID>
<NAME>Miscellaneous</NAME>
<NAME>Category 1</NAME>
</CATEGORY>
<PASSWORD></PASSWORD>
<FULLNAME>Moodle 2.0 Test Restore</FULLNAME>
Expand Down
34 changes: 17 additions & 17 deletions blocks/course_list/tests/behat/block_course_list_category.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Feature: Enable the course_list block on a category page and view it's contents
Background:
Given the following "categories" exist:
| name | category | idnumber |
| Category 1 | 0 | CAT1 |
| Category 2 | 0 | CAT2 |
| Category 3 | CAT2 | CAT3 |
| Category A | 0 | CATA |
| Category B | 0 | CATB |
| Category C | CATB | CATC |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 2 | C2 | CAT1 |
| Course 3 | C3 | CAT2 |
| Course 4 | C4 | CAT3 |
| Course 2 | C2 | CATA |
| Course 3 | C3 | CATB |
| Course 4 | C4 | CATC |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | First | teacher1@example.com |
Expand All @@ -30,30 +30,30 @@ Feature: Enable the course_list block on a category page and view it's contents
And I am on site homepage
And I turn editing mode on
And I am on course index
And I follow "Miscellaneous"
And I follow "Category 1"
And I add the "Courses" block
And I log out
When I log in as "teacher1"
And I am on course index
And I follow "Miscellaneous"
And I follow "Category 1"
Then I should see "Course 1" in the "My courses" "block"
And I should see "Course 2" in the "My courses" "block"
And I should see "Course 3" in the "My courses" "block"
And I should not see "Course 4" in the "My courses" "block"
And I follow "All courses"
And I should see "Miscellaneous"
And I should see "Category 1"

Scenario: Add the course list block on category page and navigate to another course
Given I log in as "admin"
And I am on site homepage
And I turn editing mode on
And I am on course index
And I follow "Miscellaneous"
And I follow "Category 1"
And I add the "Courses" block
And I log out
When I log in as "teacher1"
And I am on course index
And I follow "Miscellaneous"
And I follow "Category 1"
Then I should see "Course 1" in the "My courses" "block"
And I should see "Course 2" in the "My courses" "block"
And I should see "Course 3" in the "My courses" "block"
Expand All @@ -66,13 +66,13 @@ Feature: Enable the course_list block on a category page and view it's contents
And I am on site homepage
And I turn editing mode on
And I am on course index
And I follow "Miscellaneous"
And I follow "Category 1"
When I add the "Courses" block
Then I should see "Miscellaneous" in the "Course categories" "block"
And I should see "Category 1" in the "Course categories" "block"
And I should see "Category 2" in the "Course categories" "block"
And I should not see "Category 3" in the "Course categories" "block"
Then I should see "Category 1" in the "Course categories" "block"
And I should see "Category A" in the "Course categories" "block"
And I should see "Category B" in the "Course categories" "block"
And I should not see "Category C" in the "Course categories" "block"
And I should not see "Course 1" in the "Course categories" "block"
And I should not see "Course 2" in the "Course categories" "block"
And I follow "All courses"
And I should see "Miscellaneous"
And I should see "Category 1"
34 changes: 17 additions & 17 deletions blocks/course_list/tests/behat/block_course_list_course.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Feature: Enable the course_list block on a course page and view it's contents
Background:
Given the following "categories" exist:
| name | category | idnumber |
| Category 1 | 0 | CAT1 |
| Category 2 | 0 | CAT2 |
| Category 3 | CAT2 | CAT3 |
| Category A | 0 | CATA |
| Category B | 0 | CATB |
| Category C | CATB | CATC |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 2 | C2 | CAT1 |
| Course 3 | C3 | CAT2 |
| Course 4 | C4 | CAT3 |
| Course 2 | C2 | CATA |
| Course 3 | C3 | CATB |
| Course 4 | C4 | CATC |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | First | teacher1@example.com |
Expand All @@ -34,7 +34,7 @@ Feature: Enable the course_list block on a course page and view it's contents
And I should see "Course 3" in the "My courses" "block"
And I should not see "Course 4" in the "My courses" "block"
And I follow "All courses"
And I should see "Miscellaneous"
And I should see "Category 1"

Scenario: Add the course list block on course page and navigate to another course
Given I log in as "teacher1"
Expand All @@ -51,14 +51,14 @@ Feature: Enable the course_list block on a course page and view it's contents
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
When I add the "Courses" block
Then I should see "Miscellaneous" in the "Course categories" "block"
And I should see "Category 1" in the "Course categories" "block"
And I should see "Category 2" in the "Course categories" "block"
And I should not see "Category 3" in the "Course categories" "block"
Then I should see "Category 1" in the "Course categories" "block"
And I should see "Category A" in the "Course categories" "block"
And I should see "Category B" in the "Course categories" "block"
And I should not see "Category C" in the "Course categories" "block"
And I should not see "Course 1" in the "Course categories" "block"
And I should not see "Course 2" in the "Course categories" "block"
And I follow "All courses"
And I should see "Miscellaneous"
And I should see "Category 1"

Scenario: View the course list block on course page with hide all courses link enabled
Given the following config values are set as admin:
Expand All @@ -77,11 +77,11 @@ Feature: Enable the course_list block on a course page and view it's contents
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
When I add the "Courses" block
Then I should not see "Miscellaneous" in the "My courses" "block"
And I should not see "Category 1" in the "My courses" "block"
And I should not see "Category 2" in the "My courses" "block"
And I should not see "Category 3" in the "My courses" "block"
Then I should not see "Category 1" in the "My courses" "block"
And I should not see "Category A" in the "My courses" "block"
And I should not see "Category B" in the "My courses" "block"
And I should not see "Category C" in the "My courses" "block"
And I should see "Course 1" in the "My courses" "block"
And I should not see "Course 2" in the "My courses" "block"
And I follow "All courses"
And I should see "Miscellaneous"
And I should see "Category 1"
24 changes: 12 additions & 12 deletions blocks/course_list/tests/behat/block_course_list_dashboard.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Feature: Enable the course_list block on the dashboard and view it's contents
Background:
Given the following "categories" exist:
| name | category | idnumber |
| Category 1 | 0 | CAT1 |
| Category 2 | 0 | CAT2 |
| Category 3 | CAT2 | CAT3 |
| Category A | 0 | CATA |
| Category B | 0 | CATB |
| Category C | CATB | CATC |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 2 | C2 | CAT1 |
| Course 3 | C3 | CAT2 |
| Course 4 | C4 | CAT3 |
| Course 2 | C2 | CATA |
| Course 3 | C3 | CATB |
| Course 4 | C4 | CATC |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | First | teacher1@example.com |
Expand All @@ -34,7 +34,7 @@ Feature: Enable the course_list block on the dashboard and view it's contents
And I should see "Course 3" in the "My courses" "block"
And I should not see "Course 4" in the "My courses" "block"
And I follow "All courses"
And I should see "Miscellaneous"
And I should see "Category 1"

Scenario: Add the course list block on the dashboard and navigate to another course
Given I log in as "teacher1"
Expand All @@ -51,11 +51,11 @@ Feature: Enable the course_list block on the dashboard and view it's contents
Given I log in as "admin"
And I press "Customise this page"
When I add the "Courses" block
Then I should see "Miscellaneous" in the "Course categories" "block"
And I should see "Category 1" in the "Course categories" "block"
And I should see "Category 2" in the "Course categories" "block"
And I should not see "Category 3" in the "Course categories" "block"
Then I should see "Category 1" in the "Course categories" "block"
And I should see "Category A" in the "Course categories" "block"
And I should see "Category B" in the "Course categories" "block"
And I should not see "Category C" in the "Course categories" "block"
And I should not see "Course 1" in the "Course categories" "block"
And I should not see "Course 2" in the "Course categories" "block"
And I follow "All courses"
And I should see "Miscellaneous"
And I should see "Category 1"
Loading

0 comments on commit 2d65b1e

Please sign in to comment.