Merge branch 'MDL-58788-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE

This commit is contained in:
Eloy Lafuente (stronk7)
2017-05-03 19:06:13 +02:00
3 changed files with 78 additions and 0 deletions
@@ -0,0 +1,42 @@
@tool @tool_behat
Feature: Backported behat step definitions
In order to provide feature file compatibility between multiple Moodle versions
As a developer
I need to be able to use backported steps from newer Moodle versiosn
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C101 | topics |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C101 | student |
| teacher1 | C101 | editingteacher |
Scenario: I am on the course homepage
When I log in as "student1"
And I am on "Course 1" course homepage
Then I should see "Topic 1"
@javascript
Scenario: I am on the course homepage with JS
When I log in as "teacher1"
And I am on "Course 1" course homepage
Then I should see "Topic 1"
Scenario: I am on the course homepage with editing
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Then I should see "Topic 1"
And I should see "Add an activity or resource"
@javascript
Scenario: I am on the course homepage with editing and JS
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Then I should see "Topic 1"
And I should see "Add an activity or resource"
+31
View File
@@ -572,4 +572,35 @@ class behat_navigation extends behat_base {
// Restore global user variable.
$USER = $globuser;
}
/**
* Opens the course homepage.
*
* @Given /^I am on "(?P<coursefullname_string>(?:[^"]|\\")*)" course homepage$/
* @throws coding_exception
* @param string $coursefullname The full name of the course.
* @return void
*/
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 string $coursefullname 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(false)));
$this->execute("behat_forms::press_button", get_string('turneditingon'));
}
}
+5
View File
@@ -1,6 +1,11 @@
This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 3.1.6 ===
* Behat compatibility changes are now being documented at
https://docs.moodle.org/dev/Acceptance_testing/Compatibility_changes
=== 3.1.5 ===
* get_user_capability_course() now has an additional parameter 'limit'. This can be used to return a set number of records with