You are here

function CasetrackerBasicTest::testCasetrackerBasicCreation in Case Tracker 6

Same name and namespace in other branches
  1. 7 tests/casetracker_basic.test \CasetrackerBasicTest::testCasetrackerBasicCreation()

Main test routine.

File

tests/casetracker_basic.test, line 27

Class

CasetrackerBasicTest

Code

function testCasetrackerBasicCreation() {
  $auth_user = $this
    ->drupalCreateUser(array(
    'access content',
    'create projects',
    'create cases',
  ));
  $this
    ->drupalLogin($auth_user);

  // Create a project node.
  $edit = array(
    'title' => $this
      ->randomName(32),
    'body' => $this
      ->randomName(64),
  );
  $this
    ->drupalPost('node/add/casetracker-basic-project', $edit, t('Save'));
  $text = t('Project !name has been created.', array(
    '!name' => $edit['title'],
  ));
  $this
    ->assertText($text);

  // Create a case for the new project.
  $this
    ->clickLink(t('add Case'));
  $edit = array(
    'title' => $this
      ->randomName(32),
    'body' => $this
      ->randomName(64),
    'casetracker[case_priority_id]' => 2,
    'casetracker[case_type_id]' => 11,
  );
  $this
    ->drupalPost(NULL, $edit, t('Save'));
  $text = t('Case !name has been created.', array(
    '!name' => $edit['title'],
  ));
  $this
    ->assertText($text);
}