function LdapAuthorizationOg2Tests::setUp in Lightweight Directory Access Protocol (LDAP) 8.2
Same name and namespace in other branches
- 7.2 ldap_authorization/tests/Og2Tests.test \LdapAuthorizationOg2Tests::setUp()
- 7 ldap_authorization/tests/Og/Og2.test \LdapAuthorizationOg2Tests::setUp()
Overrides LdapTestCase::setUp
File
- ldap_authorization/
tests/ Og2Tests.test, line 44
Class
Code
function setUp($addl_modules = array()) {
parent::setUp(array(
'ldap_authentication',
'ldap_authorization',
'ldap_authorization_og',
));
variable_set('ldap_simpletest', 2);
if (ldap_authorization_og_og_version() != 2) {
debug('LdapAuthorizationOg2Tests must be run with OG 7.x-2.x');
return;
}
$this->user1 = $this
->drupalCreateUser();
$this->groups = array();
$this
->prepTestData(LDAP_TEST_LDAP_NAME, array(
'activedirectory1',
));
// Create group and group content node types.
$this->groupBundle = $this
->drupalCreateContentType(array(
'type' => 'group',
'name' => 'OG Group',
))->type;
og_create_field(OG_GROUP_FIELD, $this->groupEntityType, $this->groupBundle);
og_create_field(OG_AUDIENCE_FIELD, $this->groupEntityType, $this->groupBundle);
// create og group for each group in group csv
$this->testFunctions
->populateFakeLdapServerData(LDAP_TEST_LDAP_NAME, 'activedirectory1');
$this->testFunctions
->getCsvLdapData(LDAP_TEST_LDAP_NAME);
foreach ($this->testFunctions->csvTables['groups'] as $guid => $group) {
$label = $group['cn'];
$settings = array();
$settings['type'] = $this->groupBundle;
$settings[OG_GROUP_FIELD][LANGUAGE_NONE][0]['value'] = 1;
$settings['uid'] = $this->user1->uid;
$settings['title'] = $label;
$settings['type'] = 'group';
$this->group_nodes[$label] = $this
->drupalCreateNode($settings);
}
}