Skip to content

Commit

Permalink
MDL-72179 behat: Correct course category page resolving
Browse files Browse the repository at this point in the history
There were two issues here:
* I am on the [categoryname] category page page (duplicated page)
* the wrong URL was being used

Since an incorrect URL was used I felt it safe to rename the step from
'category page page' to 'category page'.
  • Loading branch information
andrewnicols committed Jul 23, 2021
1 parent c204fe3 commit ba8e0a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion admin/tool/behat/tests/behat/i_am_on_page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Feature: Use core page resolvers for the I am on the page steps

Examples:
| description | identifier | shouldsee |
| Admin page | Admin | Check for available updates |
| Home page | Homepage | Recently accessed courses |

@javascript
Expand Down
12 changes: 6 additions & 6 deletions lib/tests/behat/behat_navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -697,10 +697,10 @@ protected function resolve_core_page_url(string $name): moodle_url {
* Convert page names to URLs for steps like 'When I am on the "[identifier]" "[page type]" page'.
*
* Recognised page names are:
* | Page type | Identifier meaning | description |
* | Category page | category idnumber | List of courses in that category. |
* | Course | course shortname | Main course home pag |
* | Activity | activity idnumber | Start page for that activity |
* | Page type | Identifier meaning | description |
* | Category | category idnumber | List of courses in that category. |
* | Course | course shortname | Main course home pag |
* | Activity | activity idnumber | Start page for that activity |
*
* @param string $type identifies which type of page this is, e.g. 'Category page'.
* @param string $identifier identifies the particular page, e.g. 'test-cat'.
Expand All @@ -711,12 +711,12 @@ protected function resolve_core_page_instance_url(string $type, string $identifi
global $DB;

switch (strtolower($type)) {
case 'category page':
case 'category':
$categoryid = $this->get_category_id($identifier);
if (!$categoryid) {
throw new Exception('The specified category with idnumber "' . $identifier . '" does not exist');
}
return new moodle_url('/course/category.php', ['id' => $categoryid]);
return new moodle_url('/course/index.php', ['categoryid' => $categoryid]);

case 'course':
$courseid = $this->get_course_id($identifier);
Expand Down

0 comments on commit ba8e0a4

Please sign in to comment.