pmorganization.test in Drupal PM (Project Management) 7.2
Same filename and directory in other branches
Test definitions for PM Organization.
File
pmorganization/pmorganization.testView source
<?php
/**
* @file
* Test definitions for PM Organization.
*/
/**
* Define a test case for PM Organization.
*/
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'],
)));
}
}
Classes
Name | Description |
---|---|
PMOrganizationTestCase | Define a test case for PM Organization. |