protected function OpenAtriumAccessBaseTestCase::oaPostPermissions in Open Atrium Core 7.2
Post to a Group/Team permisisons page with a set of values.
You're expected to use $this->drupalGet() to load the admin page before calling this function to submit.
After posting to the admin form, it will verify that the permissions actually "stuck".
Parameters
array $values: An associative array keyed by the module machine name which contains an associative array keyed by the permission machine name containing arrays of group or team nids.
2 calls to OpenAtriumAccessBaseTestCase::oaPostPermissions()
- OpenAtriumAccessTestCase::testGroupAdminPage in modules/
oa_access/ tests/ oa_access.test - OpenAtriumAccessTestCase::testTeamAdminPage in modules/
oa_access/ tests/ oa_access.test
File
- modules/
oa_access/ tests/ oa_access.test, line 191 - Functional tests for the Open Atrium Access module.
Class
Code
protected function oaPostPermissions($values) {
$edit = array();
foreach ($values as $module => $permissions) {
foreach ($permissions as $name => $groups) {
$edit["permissions[{$module}][{$name}][groups][]"] = $groups;
}
}
$this
->drupalPost(NULL, $edit, t('Save permissions'));
// Verify that the settinsg 'stuck'.
foreach ($values as $module => $permissions) {
foreach ($permissions as $name => $groups) {
$results = $this
->xpath('//select[@name=:name]//option', array(
':name' => "permissions[{$module}][{$name}][groups][]",
));
$found_groups = array();
foreach ($results as $option) {
if ($option['selected']) {
$found_groups[] = (string) $option['value'];
}
}
$this
->assertEqual($found_groups, $groups, t('Settings for %permission stuck', array(
'%permission' => $name,
)));
}
}
}