From 52da2d6eaa9631347065c035dd87f2ad2e16b92a Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 20 Jul 2021 12:49:45 +0800 Subject: [PATCH] MDL-72179 behat: Correct course category page resolving 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'. --- admin/tool/behat/tests/behat/i_am_on_page.feature | 1 - lib/tests/behat/behat_navigation.php | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/admin/tool/behat/tests/behat/i_am_on_page.feature b/admin/tool/behat/tests/behat/i_am_on_page.feature index b76bd90bdad..10312f1969a 100644 --- a/admin/tool/behat/tests/behat/i_am_on_page.feature +++ b/admin/tool/behat/tests/behat/i_am_on_page.feature @@ -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 diff --git a/lib/tests/behat/behat_navigation.php b/lib/tests/behat/behat_navigation.php index 3ced70684fa..d457797c3bd 100644 --- a/lib/tests/behat/behat_navigation.php +++ b/lib/tests/behat/behat_navigation.php @@ -697,10 +697,10 @@ class behat_navigation extends behat_base { * 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'. @@ -711,12 +711,12 @@ class behat_navigation extends behat_base { 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);