function spaces::testSpaces in Spaces 6
Same name and namespace in other branches
- 5.2 tests/spaces.test \spaces::testSpaces()
- 5 tests/spaces.test \spaces::testSpaces()
- 6.2 tests/spaces.test \spaces::testSpaces()
File
- tests/
spaces.test, line 37
Class
Code
function testSpaces() {
$og_type = $this
->addNodeType();
variable_set('og_content_type_usage_' . $og_type, 'group');
// OG's own test is currently broken. Once it's fixed this line can be removed.
$web_user = $this
->drupalCreateUserRolePerm(array(
'access content',
"create {$og_type} content",
"edit {$og_type} content",
'create pages',
'create groups',
'view users outside groups',
'administer group features',
));
$this
->drupalLoginUser($web_user);
// Create the group using the modified interface for each type.
foreach (array(
'private',
'public',
'controlled',
) as $type) {
$edit = array();
$edit['title'] = '!SimpleTest test group node! ' . $this
->randomName(10);
$edit['og_description'] = '!SimpleTest test group body! ' . $this
->randomName(32) . ' ' . $this
->randomName(32);
$edit['spaces_groupmask'] = $type;
$edit['spaces_path'] = $this
->randomName(10);
$this
->drupalPostRequest("node/add/{$og_type}", $edit, 'Submit');
$node = node_load(array(
'title' => $edit['title'],
));
$this
->assertNotNull($node, 'Group found in database. %s');
$this
->assertIdentical($node->spaces_path, $edit['spaces_path'], 'Group path found in database %s');
$mask = spaces_groupmask('mask');
foreach ($mask[$type]['mask'] as $key => $value) {
$this
->assertIdentical($node->{$key}, (string) $value, "Node {$key} has been properly set %s");
}
// Establish features
$edit = array();
$edit['settings-spaces-home'] = 'pass_thru';
$this
->drupalPostRequest("node/" . $node->nid . "/features", $edit, 'Submit');
$features = spaces_features($node->nid, 'settings');
$this
->assertIdentical($edit['settings-spaces-home'], $features['spaces_home'], "Home page was set %s");
$this->_cleanupGroups[] = $node->nid;
}
return $node->nid;
}