Merge branch 'MDL-50055-28' of git://github.com/andrewnicols/moodle into MOODLE_28_STABLE

This commit is contained in:
David Monllao
2015-05-05 10:52:07 +08:00
4 changed files with 23 additions and 10 deletions
@@ -23,7 +23,6 @@ Feature: Guest users can auto-enrol themself in courses where guest access is al
| Description | Test forum description |
And I click on "Edit settings" "link" in the "Administration" "block"
@javascript
Scenario: Allow guest access without password
Given I set the following fields to these values:
| Allow guest access | Yes |
@@ -34,7 +33,6 @@ Feature: Guest users can auto-enrol themself in courses where guest access is al
When I follow "Test forum name"
Then I should not see "Subscribe to this forum"
@javascript
Scenario: Allow guest access with password
Given I set the following fields to these values:
| Allow guest access | Yes |
@@ -16,6 +16,8 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
| user | course | role |
| teacher1 | C1 | editingteacher |
# Note: Please keep the javascript tag on this Scenario to ensure that we
# test use of the singleselect functionality.
@javascript
Scenario: Self-enrolment enabled as guest
Given I log in as "teacher1"
@@ -29,7 +31,6 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
And I press "Continue"
And I should see "Log in"
@javascript
Scenario: Self-enrolment enabled
Given I log in as "teacher1"
And I follow "Course 1"
@@ -42,7 +43,6 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
Then I should see "Topic 1"
And I should not see "Enrolment options"
@javascript
Scenario: Self-enrolment enabled requiring an enrolment key
Given I log in as "teacher1"
And I follow "Course 1"
@@ -59,13 +59,11 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
And I should not see "Enrolment options"
And I should not see "Enrol me in this course"
@javascript
Scenario: Self-enrolment disabled
Given I log in as "student1"
When I follow "Course 1"
Then I should see "You can not enrol yourself in this course"
@javascript
Scenario: Self-enrolment enabled requiring a group enrolment key
Given I log in as "teacher1"
And I follow "Course 1"
@@ -87,4 +85,4 @@ Feature: Users can auto-enrol themself in courses where self enrolment is allowe
And I press "Enrol me"
Then I should see "Topic 1"
And I should not see "Enrolment options"
And I should not see "Enrol me in this course"
And I should not see "Enrol me in this course"
+3 -3
View File
@@ -48,13 +48,13 @@ class behat_enrol extends behat_base {
* @param TableNode $table
*/
public function i_add_enrolment_method_with($enrolmethod, TableNode $table) {
return array(
new Given('I expand "' . get_string('users', 'admin') . '" node'),
new Given('I follow "' . get_string('type_enrol_plural', 'plugin') . '"'),
new Given('I set the field "' . get_string('addinstance', 'enrol') . '" to "' . $this->escape($enrolmethod) . '"'),
new Given('I select "' . $this->escape($enrolmethod) . '" from the "' .
get_string('addinstance', 'enrol') . '" singleselect'),
new Given('I set the following fields to these values:', $table),
new Given('I press "' . get_string('addinstance', 'enrol') . '"')
new Given('I press "' . get_string('addinstance', 'enrol') . '"'),
);
}
+17
View File
@@ -369,4 +369,21 @@ class behat_forms extends behat_base {
$field->set_value($value);
}
/**
* Select a value from single select and redirect.
*
* @Given /^I select "(?P<singleselect_option_string>(?:[^"]|\\")*)" from the "(?P<singleselect_name_string>(?:[^"]|\\")*)" singleselect$/
*/
public function i_select_from_the_singleselect($option, $singleselect) {
$actions = array(
new Given('I set the field "' . $this->escape($singleselect) . '" to "' . $this->escape($option) . '"'),
);
if (!$this->running_javascript()) {
$actions[] = new Given('I press "' . get_string('go') . '"');
}
return $actions;
}
}