Skip to content

Commit

Permalink
MDL-83331 behat: enable navigation direct to mod/.../index.php
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt committed Oct 1, 2024
1 parent 30692df commit 94611e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/tests/behat/behat_navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -937,10 +937,12 @@ protected function resolve_core_page_instance_url(string $type, string $identifi
]);
}

// This next section handles page types starting with an activity name. For example:
// "forum activity" or "quiz activity editing".
$parts = explode(' ', $type);
if (count($parts) > 1) {
$modname = $parts[0];
if ($parts[1] === 'activity') {
$modname = $parts[0];
$cm = $this->get_cm_by_activity_name($modname, $identifier);

if (count($parts) == 2) {
Expand All @@ -962,6 +964,13 @@ protected function resolve_core_page_instance_url(string $type, string $identifi
// Permissions page.
return new moodle_url('/admin/roles/permissions.php', ['contextid' => $cm->context->id]);
}

} else if ($parts[1] === 'index' && count($parts) == 2) {
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw $coursenotfoundexception;
}
return new moodle_url("/mod/$modname/index.php", ['id' => $courseid]);
}
}

Expand Down
4 changes: 4 additions & 0 deletions mod/forum/tests/behat/add_forum.feature
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Feature: Add forum activities and discussions
And I follow "Edit"
And the field "Attachment" matches value "empty.txt"

# Check the page that lists all the forums in a course.
And I am on the "C1" "forum index" page
And I should see "Test forum name"

Scenario: Test forum settings validation
Given the following "courses" exist:
| fullname | shortname | category |
Expand Down

0 comments on commit 94611e8

Please sign in to comment.