public function PMExpenseTestCase::testpmexpenseCreate in Drupal PM (Project Management) 7.3
Same name and namespace in other branches
- 8 pmexpense/pmexpense.test \PMExpenseTestCase::testpmexpenseCreate()
- 7 pmexpense/pmexpense.test \PMExpenseTestCase::testpmexpenseCreate()
- 7.2 pmexpense/pmexpense.test \PMExpenseTestCase::testpmexpenseCreate()
Tests creation of an Expense.
File
- pmexpense/
pmexpense.test, line 48 - Test definitions for PM Expense.
Class
- PMExpenseTestCase
- Define a test case for PM Expense.
Code
public function testpmexpenseCreate() {
// Test access to the PM Expense list for anonymous users.
$this
->drupalGet('pm/expenses');
$this
->assertResponse(403, t('Make sure access is denied to Project Management Expense list for anonymous user'));
// Create user with no additional permissions, and login.
$user_basic = $this
->drupalCreateUser();
$this
->drupalLogin($user_basic);
// Test access to the PM Expense list for this basic user.
$this
->drupalGet('pm/expenses');
$this
->assertResponse(403, t('Make sure access is denied to Project Management Expense list for basic user'));
// Create user with permissions to add content.
$user_content = $this
->drupalCreateUser(array(
'create pmexpense content',
));
$this
->drupalLogin($user_content);
// Create an expense node.
$expense = array(
'title' => $this
->randomName(32),
);
$this
->drupalPost('node/add/pmexpense', $expense, t('Save'));
// Test that the expense node is created.
$this
->assertText(t('Expense @title has been created.', array(
'@title' => $expense['title'],
)));
}