public function LdapAuthorizationOg2Tests::getTestData in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.2 ldap_authorization/tests/Og2Tests.test \LdapAuthorizationOg2Tests::getTestData()
Get test data in convenient format, so tests are easier to read and write.
2 calls to LdapAuthorizationOg2Tests::getTestData()
- LdapAuthorizationOg2Tests::testBasicFunctionsAndApi in ldap_authorization/
tests/ Og2Tests.test - Just make sure install succeeds and.
- LdapAuthorizationOg2Tests::testFlags in ldap_authorization/
tests/ Og2Tests.test - Authorization configuration flags tests clumped together.
File
- ldap_authorization/
tests/ Og2Tests.test, line 110
Class
- LdapAuthorizationOg2Tests
- Simpletest for Ldap Authorization OG Module, for og 7.x-2.x.
Code
public function getTestData($debug = FALSE) {
$group_nodes = [];
$group_nids = [];
$group_entity_ids = [];
$roles = [];
$roles_by_name = [];
$consumer_ids = [];
foreach ([
'gryffindor',
'students',
'faculty',
'users',
'hufflepuff',
'slytherin',
] as $i => $group_name) {
list($group_nodes[$group_name], $group_entity_ids[$group_name]) = ldap_authorization_og2_get_group_from_name($this->groupEntityType, $group_name);
$nid = $group_nodes[$group_name]->nid;
$group_nids[$group_name] = $nid;
$roles[$group_name] = og_roles($this->groupEntityType, $this->groupBundle, $nid, FALSE, TRUE);
$roles_by_name[$group_name] = array_flip($roles[$group_name]);
foreach ($roles[$group_name] as $rid => $role_name) {
$consumer_ids[$group_name][$role_name] = ldap_authorization_og_authorization_id($nid, $rid, 'node');
$consumer_ids[$group_name][$rid] = ldap_authorization_og_authorization_id($nid, $rid, 'node');
}
}
if ($debug) {
debug("group_nids");
debug($group_nids);
debug("group_entity_ids");
debug($group_entity_ids);
debug("roles");
debug($roles);
debug("roles_by_name");
debug($roles_by_name);
}
return [
$group_nodes,
$group_nids,
$group_entity_ids,
$roles_by_name,
$consumer_ids,
];
}