class PMTestCase in Drupal PM (Project Management) 8
Same name and namespace in other branches
- 7.3 pm.test \PMTestCase
- 7 pm.test \PMTestCase
- 7.2 pm.test \PMTestCase
Define a test case for Project Management.
Hierarchy
- class \PMTestCase extends \DrupalWebTestCase
Expanded class hierarchy of PMTestCase
File
- ./
pm.test, line 10 - Test definitions for Project Management.
View source
class PMTestCase extends DrupalWebTestCase {
/**
* Returns meta data for Project Management tests.
*/
public static function getInfo() {
return array(
'name' => 'Project Management functionality',
'description' => 'Test the functionality of the Project Management base module',
'group' => 'Project Management',
);
}
/**
* Standard set up for all tests.
*/
public function setUp() {
parent::setUp('pm');
}
/**
* Tests access to Project Management pages.
*/
public function testpmAccess() {
$this
->drupalGet('pm');
$this
->assertResponse(403, t('Make sure access is denied to Project Management dashboard for anonymous user'));
$basic_user = $this
->drupalCreateUser();
$this
->drupalLogin($basic_user);
$this
->drupalGet('pm');
$this
->assertResponse(403, t('Make sure access is denied to Project Management dashboard for basic user'));
$privileged_user = $this
->drupalCreateUser(array(
'Project Management: access dashboard',
));
$this
->drupalLogin($privileged_user);
$this
->drupalGet('pm');
$this
->assertText(t('Project Management'), t('Make sure the correct page has been displayed by checking that the title is "Project Management".'));
}
/**
* Tests access to Project Management settings pages.
*/
public function testpmAccessSettings() {
$this
->drupalGet('admin/config/pm');
$this
->assertResponse(403, t('Make sure access is denied to Project Management settings page for anonymous user'));
$this
->drupalGet('admin/config/pm/pm');
$this
->assertResponse(403, t('Make sure access is denied to Project Management settings page for anonymous user'));
$basic_user = $this
->drupalCreateUser();
$this
->drupalLogin($basic_user);
$this
->drupalGet('admin/config/pm');
$this
->assertResponse(403, t('Make sure access is denied to Project Management settings page for basic user'));
$this
->drupalGet('admin/config/pm/pm');
$this
->assertResponse(403, t('Make sure access is denied to Project Management settings page for basic user'));
$privileged_user = $this
->drupalCreateUser(array(
'Project Management: access administration pages',
));
$this
->drupalLogin($privileged_user);
$this
->drupalGet('admin/config/pm');
$this
->assertText(t('Project Management'), t('Make sure the correct page has been displayed by checking that the title of the settings page is "Project Management".'));
$this
->drupalGet('admin/config/pm/pm');
$this
->assertText(t('Project Management'), t('Make sure the correct page has been displayed by checking that the title of the settings page is "Project Management".'));
}
/**
* Tests module uninstall path.
*/
public function testpmUninstall() {
$module = array(
'pm',
);
module_disable($module);
$result = drupal_uninstall_modules($module);
$this
->AssertTrue($result, t('Module successfully uninstalled.'));
}
/**
* Tests compatibility between submodules.
*/
public function testpmEnableAll() {
$submodules = array(
'pmexpense',
'pmissue',
'pmnote',
'pmorganization',
'pmperson',
'pmproject',
'pmtask',
'pmteam',
'pmticket',
'pmtimetracking',
);
$result = module_enable($submodules, TRUE);
$this
->assertTrue($result, t('Modules enabled successfully.'));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PMTestCase:: |
public static | function | Returns meta data for Project Management tests. | |
PMTestCase:: |
public | function | Standard set up for all tests. | |
PMTestCase:: |
public | function | Tests access to Project Management pages. | |
PMTestCase:: |
public | function | Tests access to Project Management settings pages. | |
PMTestCase:: |
public | function | Tests compatibility between submodules. | |
PMTestCase:: |
public | function | Tests module uninstall path. |