Skip to content

Commit

Permalink
MDL-58265 core_test: add I am on course homepage in edit mode step
Browse files Browse the repository at this point in the history
This commit also:
- Rename i_am_on_course_page to i_am_on_course_homepage.
- Pass false to out_as_local_url()

Part of MDL-55611 epic.
  • Loading branch information
lameze authored and Damyon Wiese committed Apr 3, 2017
1 parent 93be3f7 commit 3353cfd
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions lib/tests/behat/behat_navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,19 +575,37 @@ public function i_open_my_profile_in_edit_mode() {
}

/**
* Opens the course page.
* Opens the course homepage.
*
* @Given /^I am on course page "(?P<coursefullname_string>(?:[^"]|\\")*)"$/
* @Given /^I am on "(?P<coursefullname_string>(?:[^"]|\\")*)" course homepage$/
* @throws coding_exception
* @param $coursefullname string The full name of the course.
* @return void
*/
public function i_am_on_course_page($coursefullname) {
public function i_am_on_course_homepage($coursefullname) {
global $DB;

$course = $DB->get_record("course", array("fullname" => $coursefullname), 'id', MUST_EXIST);
$url = new moodle_url('/course/view.php', ['id' => $course->id]);
$this->getSession()->visit($this->locate_path($url->out_as_local_url(false)));
}

/**
* Opens the course homepage with editing mode on.
*
* @Given /^I am on "(?P<coursefullname_string>(?:[^"]|\\")*)" course homepage with editing mode on$/
* @throws coding_exception
* @param $coursefullname string The course full name of the course.
* @return void
*/
public function i_am_on_course_homepage_with_editing_mode_on($coursefullname) {
global $DB;
$course = $DB->get_record("course", array("fullname" => $coursefullname), 'id', MUST_EXIST);
$url = new moodle_url('/course/view.php', ['id' => $course->id]);
$this->getSession()->visit($this->locate_path($url->out_as_local_url()));
$this->getSession()->visit($this->locate_path($url->out_as_local_url(false)));
try {
$this->execute("behat_forms::press_button", get_string('turneditingon'));
} catch (Exception $e) {
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration", [get_string('turneditingon')]);
}
}
}

0 comments on commit 3353cfd

Please sign in to comment.