You are here

public function PMTicketTestCase::testpmticketCreate in Drupal PM (Project Management) 7

Same name and namespace in other branches
  1. 8 pmticket/pmticket.test \PMTicketTestCase::testpmticketCreate()
  2. 7.3 pmticket/pmticket.test \PMTicketTestCase::testpmticketCreate()
  3. 7.2 pmticket/pmticket.test \PMTicketTestCase::testpmticketCreate()

Test case covering creation of pmtickets.

File

pmticket/pmticket.test, line 47
Test definitions for the PM Ticket module.

Class

PMTicketTestCase
@file Test definitions for the PM Ticket module.

Code

public function testpmticketCreate() {

  // 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',
  ));
  $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),
  );
  $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
    ->assertText(t('Ticket @title has been created.', array(
    '@title' => $ticket['title'],
  )));
}