You are here

public function PMTimetrackingTestCase::testpmtimetrackingCreate in Drupal PM (Project Management) 7

Same name and namespace in other branches
  1. 8 pmtimetracking/pmtimetracking.test \PMTimetrackingTestCase::testpmtimetrackingCreate()
  2. 7.3 pmtimetracking/pmtimetracking.test \PMTimetrackingTestCase::testpmtimetrackingCreate()
  3. 7.2 pmtimetracking/pmtimetracking.test \PMTimetrackingTestCase::testpmtimetrackingCreate()

Test case covering creation of pmtimetrackings.

File

pmtimetracking/pmtimetracking.test, line 29
Test definitions for the PM Timetracking module.

Class

PMTimetrackingTestCase
@file Test definitions for the PM Timetracking module.

Code

public function testpmtimetrackingCreate() {

  // Create and login user
  $user = $this
    ->drupalCreateUser(array(
    'Project Management Organization: add',
    'Project Management Organization: view all',
    'Project Management Project: add',
    'Project Management Project: view all',
    'Project Management Task: add',
    'Project Management Task: view all',
    'Project Management Ticket: add',
    'Project Management Ticket: view all',
    'Project Management Timetracking: add',
    'Project Management Timetracking: view all',
  ));
  $this
    ->drupalLogin($user);

  // Create organization and invoice
  $org = array(
    'title' => $this
      ->randomName(32),
    'body[und][0][value]' => $this
      ->randomName(64),
  );
  $prj = array(
    'title' => $this
      ->randomName(32),
    'organization_nid' => '1',
  );
  $task = array(
    'title' => $this
      ->randomName(32),
    'body[und][0][value]' => $this
      ->randomName(64),
  );
  $ticket = array(
    'title' => $this
      ->randomName(32),
    'body[und][0][value]' => $this
      ->randomName(64),
  );
  $timetracking = array(
    'title' => $this
      ->randomName(32),
    'body[und][0][value]' => $this
      ->randomName(64),
  );
  $this
    ->drupalPost('node/add/pmorganization', $org, t('Save'));
  $this
    ->drupalPost('node/add/pmproject', $prj, t('Save'));
  $this
    ->drupalPost('node/add/pmtask', $task, t('Save'));
  $this
    ->drupalPost('node/add/pmticket', $ticket, t('Save'));
  $this
    ->drupalPost('node/add/pmtimetracking', $timetracking, t('Save'));
  $this
    ->assertText(t('Timetracking @title has been created.', array(
    '@title' => $timetracking['title'],
  )));
}