| 1 |
<?php
|
| 2 |
// $Id: spaces.test,v 1.1 2008/06/18 03:16:23 jmiccolis Exp $
|
| 3 |
|
| 4 |
require_once dirname(__FILE__). '/../../og/tests/og_testcase.php';
|
| 5 |
|
| 6 |
class spaces extends OgTestCase {
|
| 7 |
/**
|
| 8 |
* Implementation of get_info() for information
|
| 9 |
*/
|
| 10 |
function get_info() {
|
| 11 |
return array(
|
| 12 |
'name' => t('Group Creation'),
|
| 13 |
'desc' => t('Test group creation and basic feature settings.') ,
|
| 14 |
'group' => 'Spaces Tests'
|
| 15 |
);
|
| 16 |
}
|
| 17 |
|
| 18 |
function setUp() {
|
| 19 |
$this->drupalModuleEnable('context');
|
| 20 |
$this->drupalModuleEnable('context_ui');
|
| 21 |
$this->drupalModuleEnable('context_prefix');
|
| 22 |
$this->drupalModuleEnable('views');
|
| 23 |
$this->drupalModuleEnable('og');
|
| 24 |
$this->drupalModuleEnable('spaces');
|
| 25 |
|
| 26 |
parent::setUp();
|
| 27 |
}
|
| 28 |
|
| 29 |
function tearDown() {
|
| 30 |
$this->drupalModuleDisable('context');
|
| 31 |
$this->drupalModuleDisable('context_ui');
|
| 32 |
$this->drupalModuleDisable('context_prefix');
|
| 33 |
$this->drupalModuleDisable('views');
|
| 34 |
$this->drupalModuleDisable('og');
|
| 35 |
$this->drupalModuleDisable('spaces');
|
| 36 |
|
| 37 |
parent::tearDown();
|
| 38 |
}
|
| 39 |
|
| 40 |
function testSpaces() {
|
| 41 |
$og_type = $this->addNodeType();
|
| 42 |
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.
|
| 43 |
$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'));
|
| 44 |
$this->drupalLoginUser($web_user);
|
| 45 |
|
| 46 |
// Create the group using the modified interface for each type.
|
| 47 |
foreach(array('private', 'public', 'controlled') as $type) {
|
| 48 |
$edit = array();
|
| 49 |
$edit['title'] = '!SimpleTest test group node! ' . $this->randomName(10);
|
| 50 |
$edit['og_description'] = '!SimpleTest test group body! ' . $this->randomName(32) . ' ' . $this->randomName(32);
|
| 51 |
$edit['spaces_groupmask'] = $type;
|
| 52 |
$edit['spaces_path'] = $this->randomName(10);
|
| 53 |
$this->drupalPostRequest("node/add/$og_type", $edit, 'Submit');
|
| 54 |
|
| 55 |
$node = node_load(array('title' => $edit['title']));
|
| 56 |
$this->assertNotNull($node, 'Group found in database. %s');
|
| 57 |
$this->assertIdentical($node->spaces_path, $edit['spaces_path'], 'Group path found in database %s');
|
| 58 |
$mask = spaces_groupmask('mask');
|
| 59 |
foreach ($mask[$type]['mask'] as $key => $value) {
|
| 60 |
$this->assertIdentical($node->$key, (string)$value, "Node $key has been properly set %s");
|
| 61 |
}
|
| 62 |
|
| 63 |
// Establish features
|
| 64 |
$edit = array();
|
| 65 |
$edit['settings-spaces-home'] = 'pass_thru';
|
| 66 |
$this->drupalPostRequest("node/". $node->nid ."/features", $edit, 'Submit');
|
| 67 |
|
| 68 |
$features = spaces_features($node->nid, 'settings');
|
| 69 |
$this->assertIdentical($edit['settings-spaces-home'], $features['spaces_home'], "Home page was set %s");
|
| 70 |
|
| 71 |
$this->_cleanupGroups[] = $node->nid;
|
| 72 |
}
|
| 73 |
return $node->nid;
|
| 74 |
}
|
| 75 |
}
|