class PMOrganizationTestCase in Drupal PM (Project Management) 8
Same name and namespace in other branches
- 7.3 pmorganization/pmorganization.test \PMOrganizationTestCase
- 7 pmorganization/pmorganization.test \PMOrganizationTestCase
- 7.2 pmorganization/pmorganization.test \PMOrganizationTestCase
Define a test case for PM Organization.
Hierarchy
- class \PMOrganizationTestCase extends \DrupalWebTestCase
Expanded class hierarchy of PMOrganizationTestCase
File
- pmorganization/
pmorganization.test, line 10 - Test definitions for PM Organization.
View source
class PMOrganizationTestCase extends DrupalWebTestCase {
/**
* Provides metadata about this group of test cases.
*/
public static function getInfo() {
return array(
'name' => 'PM Organization',
'description' => 'Test the functionality of the PM Organization module',
'group' => 'Project Management',
);
}
/**
* Standard configuration for all test cases.
*/
public function setUp() {
parent::setUp('views', 'pm', 'link', 'email', 'addressfield', 'pmorganization');
}
/**
* Test case ensuring that the list view is present.
*/
public function testpmorganizationList() {
// Anonymous user.
$this
->drupalGet('pm/organizations');
$this
->assertResponse(403, 'Access is denied to the anonymous user.');
// Authenticated user.
$authenticated_user = $this
->drupalCreateUser();
$this
->drupalLogin($authenticated_user);
$this
->drupalGet('pm/organizations');
$this
->assertResponse(403, 'Access is denied to the authenticated user.');
// Privileged user.
$privileged_user = $this
->drupalCreateUser(array(
'Project Management Organization: access',
));
$this
->drupalLogin($privileged_user);
$this
->drupalGet('pm/organizations');
$this
->assertText(t('Organizations'), t('Access granted for the privileged user. Correct page has been confirmed by checking that the title is "Organizations".'));
}
/**
* Test case ensuring that organization nodes can be created.
*/
public function testpmorganizationCreate() {
// Log in with permission to create test content.
$user = $this
->drupalCreateUser(array(
'access content',
'create pmorganization content',
));
$this
->drupalLogin($user);
// Create test content.
$edit = array(
'title' => $this
->randomName(32),
);
$this
->drupalPost('node/add/pmorganization', $edit, t('Save'));
$this
->assertText(t('Organization @title has been created.', array(
'@title' => $edit['title'],
)));
}
/**
* Tests module uninstall path.
*/
public function testpmorganizationUninstall() {
$module = array(
'pmorganization',
);
module_disable($module);
$result = drupal_uninstall_modules($module);
$this
->AssertTrue($result, t('Module successfully uninstalled.'));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PMOrganizationTestCase:: |
public static | function | Provides metadata about this group of test cases. | |
PMOrganizationTestCase:: |
public | function | Standard configuration for all test cases. | |
PMOrganizationTestCase:: |
public | function | Test case ensuring that organization nodes can be created. | |
PMOrganizationTestCase:: |
public | function | Test case ensuring that the list view is present. | |
PMOrganizationTestCase:: |
public | function | Tests module uninstall path. |