You are here

public function PMNoteTestCase::testpmnoteCreate in Drupal PM (Project Management) 7

Same name and namespace in other branches
  1. 8 pmnote/pmnote.test \PMNoteTestCase::testpmnoteCreate()
  2. 7.3 pmnote/pmnote.test \PMNoteTestCase::testpmnoteCreate()
  3. 7.2 pmnote/pmnote.test \PMNoteTestCase::testpmnoteCreate()

Node creation test case.

File

pmnote/pmnote.test, line 51
Test definitions for the PM Note module.

Class

PMNoteTestCase
Test definition for the PM Note module.

Code

public function testpmnoteCreate() {

  // 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 note: add',
    'Project Management note: 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),
  );
  $note = 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/pmnote', $note, t('Save'));
  $this
    ->assertText(t('Note @title has been created.', array(
    '@title' => $note['title'],
  )));
}