abstract class oa_coreBaseWebTest in Open Atrium Core 7.2
Base class for testing openatrium web interaction.
It will try installing openatrium. For a quicker test, replace SimpleTestCloneTestCase with SimpleTestCloneTestCase from the simpletest_clone module.
See http://drupal.org/project/installprofiletest for patches need to have a successful run w/o simpletest clone.
Hierarchy
- class \oa_coreBaseWebTest extends \SimpleTestCloneTestCase
Expanded class hierarchy of oa_coreBaseWebTest
File
- tests/
oa_coreBase.test, line 18 - Provides a base unit test class.
View source
abstract class oa_coreBaseWebTest extends SimpleTestCloneTestCase {
protected $profile = 'openatrium';
protected function setUp() {
parent::setUp();
// Override the mail system to prevent fatal errors.
variable_set('mail_system', array(
'default-system' => 'oaTestingMailSystem',
));
}
protected function createOaSpace($node_info = array()) {
$node_info += array(
'type' => 'oa_space',
);
return $this
->drupalCreateNode($node_info);
}
protected function createNodeInOaSpace($space, $node_info) {
$node_info['og_group_ref'][LANGUAGE_NONE][0]['target_id'] = $space->nid;
$node = $this
->drupalCreateNode($node_info);
og_group('node', $space, array(
'entity' => $node,
));
return $node;
}
protected function createOaSpaceAndUsers($space_info = array(), $admin_permissions = array()) {
$admin = $this
->drupalCreateUser($admin_permissions ? $admin_permissions : array(
'create oa_space content',
'create oa_section content',
'edit any oa_section content',
));
$space = $this
->createOaSpace($space_info + array(
'uid' => $admin->uid,
));
return array(
'space' => $space,
'space_member' => $this
->createUserInOaSpace($space),
'space_admin' => $admin,
);
}
protected function createUserInOaSpace($space, $permissions = array()) {
$member = $this
->drupalCreateUser();
og_group('node', $space, array(
'entity' => $member,
));
return $member;
}
protected function oaSpaceIsPublic($space) {
return empty($space->group_access[LANGUAGE_NONE][0]['value']);
}
protected function oaSetOGPermission($perm, $access = 1) {
$roles = array_flip(og_roles('node', 'oa_space'));
// Add create permission.
$permissions = array(
$perm => $access,
);
og_role_change_permissions($roles[OG_AUTHENTICATED_ROLE], $permissions);
drupal_static_reset('node_access');
}
protected function assertOptionExists($id, $option, $message = '') {
$elements = $this
->xpath('//select[@id=:id]//option[@value=:option]', array(
':id' => $id,
':option' => $option,
));
return $this
->assertTrue(!empty($elements[0]), $message ? $message : t('Option @option for field @id is selected.', array(
'@option' => $option,
'@id' => $id,
)), t('Browser'));
}
protected function assertOptionNoExists($id, $option, $message = '') {
$elements = $this
->xpath('//select[@id=:id]//option[@value=:option]', array(
':id' => $id,
':option' => $option,
));
return $this
->assertTrue(empty($elements[0]), $message ? $message : t('Option @option for field @id is selected.', array(
'@option' => $option,
'@id' => $id,
)), t('Browser'));
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
oa_coreBaseWebTest:: |
protected | property | ||
oa_coreBaseWebTest:: |
protected | function | ||
oa_coreBaseWebTest:: |
protected | function | ||
oa_coreBaseWebTest:: |
protected | function | ||
oa_coreBaseWebTest:: |
protected | function | ||
oa_coreBaseWebTest:: |
protected | function | ||
oa_coreBaseWebTest:: |
protected | function | ||
oa_coreBaseWebTest:: |
protected | function | ||
oa_coreBaseWebTest:: |
protected | function | ||
oa_coreBaseWebTest:: |
protected | function |