Skip to content

Commit

Permalink
Merge branch 'wip-MDL-51062-master' of git://github.com/marinaglancy/…
Browse files Browse the repository at this point in the history
…moodle
  • Loading branch information
David Monllao committed Aug 10, 2015
2 parents 3f3bf3d + 7f0c7f0 commit f5d23fc
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 18 deletions.
5 changes: 2 additions & 3 deletions admin/tool/behat/tests/behat/edit_permissions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Feature: Edit capabilities
| user | course | role |
| teacher1 | C1 | editingteacher |

@javascript
Scenario: Default system capabilities modification
Given I log in as "admin"
And I set the following system permissions of "Teacher" role:
Expand All @@ -30,7 +29,6 @@ Feature: Edit capabilities
And "moodle/grade:managesharedforms" capability has "Prevent" permission
And "moodle/course:request" capability has "Prohibit" permission

@javascript
Scenario: Course capabilities overrides
Given I log in as "teacher1"
And I follow "Course 1"
Expand All @@ -41,11 +39,11 @@ Feature: Edit capabilities
| mod/forum:editanypost | Prevent |
| mod/forum:addquestion | Allow |
When I set the field "Advanced role override" to "Student (3)"
And I press "Go"
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
And "mod/forum:editanypost" capability has "Prevent" permission
And "mod/forum:addquestion" capability has "Allow" permission

@javascript
Scenario: Module capabilities overrides
Given I log in as "teacher1"
And I follow "Course 1"
Expand All @@ -60,6 +58,7 @@ Feature: Edit capabilities
| mod/forum:editanypost | Prevent |
| mod/forum:addquestion | Allow |
When I set the field "Advanced role override" to "Student (3)"
And I press "Go"
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
And "mod/forum:editanypost" capability has "Prevent" permission
And "mod/forum:addquestion" capability has "Allow" permission
1 change: 0 additions & 1 deletion blocks/tests/behat/restrict_available_blocks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Feature: Allowed blocks controls
Then I should see "Activities" in the "Activities" "block"
And I should see "Course completion status" in the "Course completion status" "block"

@javascript
Scenario: Blocks can not be added when the admin restricts the permissions
Given I log in as "admin"
And I set the following system permissions of "Teacher" role:
Expand Down
1 change: 0 additions & 1 deletion course/tests/behat/navigate_course_list.feature
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Feature: Browse course list and return back from enrolment page
And I press "Continue"
Then I should see "Edit profile" in the ".breadcrumb-nav" "css_element"

@javascript
Scenario: User can return to the choice activity from enrolment page
Given the following "roles" exist:
| name | shortname | description | archetype |
Expand Down
1 change: 0 additions & 1 deletion course/tests/behat/restrict_available_activities.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Feature: Restrict activities availability
Then I should see "Test glossary name"
And I should see "Test chat name"

@javascript
Scenario: Activities can not be added when the admin restricts the permissions
Given I log in as "admin"
And I set the following system permissions of "Teacher" role:
Expand Down
1 change: 0 additions & 1 deletion group/tests/behat/create_groups.feature
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ Feature: Organize students into groups
And I should see "Student 3"
And I should not see "Student 0"

@javascript
Scenario: Create groups and groupings without the 'moodle/course:changeidnumber' capability
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
Expand Down
16 changes: 10 additions & 6 deletions lib/tests/behat/behat_permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ public function i_override_the_system_permissions_of_role_with($rolename, $table
// We don't know the number of overrides so we have to get it to match the option contents.
$roleoption = $this->find('xpath', '//select[@name="roleid"]/option[contains(.,"' . $this->escape($rolename) . '")]');

return array(
$result = array(
new Given('I set the field "' . get_string('advancedoverride', 'role') .
'" to "' . $this->escape($roleoption->getText()) . '"'),
new Given('I fill the capabilities form with the following permissions:', $table),
new Given('I press "' . get_string('savechanges') . '"')
);
'" to "' . $this->escape($roleoption->getText()) . '"'));
if (!$this->running_javascript()) {
$result[] = new Given('I press "' . get_string('go') . '"');
}
$result[] = new Given('I fill the capabilities form with the following permissions:', $table);
$result[] = new Given('I press "' . get_string('savechanges') . '"');
return $result;
}

/**
Expand Down Expand Up @@ -132,7 +135,8 @@ public function i_fill_the_capabilities_form_with_the_following_permissions($tab

// Here we wait for the element to appear and exception if it does not exist.
$radio = $this->find('xpath', '//input[@name="' . $capability . '" and @value="' . $permissionvalue . '"]');
$radio->click();
$field = behat_field_manager::get_field_instance('radio', $radio, $this->getSession());
$field->set_value(1);
}
}

Expand Down
2 changes: 0 additions & 2 deletions mod/forum/tests/behat/separate_group_discussions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ Feature: Posting to all groups in a separate group discussion is restricted to u
And the "Group" select box should contain "Group B"
And I should see "Post a copy to all groups"

@javascript
Scenario: Teacher in all groups but without accessallgroups can only post in their groups
And I log in as "admin"
And I set the following system permissions of "Non-editing teacher" role:
Expand All @@ -71,7 +70,6 @@ Feature: Posting to all groups in a separate group discussion is restricted to u
And the "Group" select box should contain "Group B"
And I should see "Post a copy to all groups"

@javascript
Scenario: Teacher in some groups and without accessallgroups can only post in their groups
And I log in as "admin"
And I set the following system permissions of "Non-editing teacher" role:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ Feature: Posting to groups in a separate group discussion when restricted to gro
And the "Group" select box should contain "G2G1"
And I should see "Post a copy to all groups"

@javascript
Scenario: Teacher in all groups but without accessallgroups can post in either group but not to All Participants
And I log in as "admin"
And I set the following system permissions of "Non-editing teacher" role:
Expand Down
1 change: 0 additions & 1 deletion my/tests/behat/restrict_available_blocks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Feature: Restrict which blocks can be added to Dashboard
And the "Add a block" select box should contain "HTML"
And the "Add a block" select box should contain "Tags"

@javascript
Scenario: Remove the ability to add the comments block to Dashboard
When I log in as "admin"
And I set the following system permissions of "Authenticated user" role:
Expand Down
1 change: 0 additions & 1 deletion user/tests/behat/view_full_profile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Feature: Access to full profiles of users
And I follow "Full profile"
Then I should see "First access to site"

@javascript
Scenario: Viewing full profiles with global permission
Given I log in as "admin"
And I set the following system permissions of "Authenticated user" role:
Expand Down

0 comments on commit f5d23fc

Please sign in to comment.