You are here

pmtimetracking.test in Drupal PM (Project Management) 7.2

Test definitions for PM Timetracking.

File

pmtimetracking/pmtimetracking.test
View source
<?php

/**
 * @file
 * Test definitions for PM Timetracking.
 */

/**
 * Define a test case for PM Timetracking.
 */
class PMTimetrackingTestCase extends DrupalWebTestCase {

  /**
   * Provides metadata about this group of test cases.
   */
  public static function getInfo() {
    return array(
      'name' => t('PM Timetracking Functionality'),
      'description' => t('Test the functionality of the PM Timetracking module'),
      'group' => 'Project Management',
    );
  }

  /**
   * Standard configuration for all test cases.
   */
  public function setUp() {
    parent::setUp('pm', 'pmorganization', 'pmproject', 'pmtask', 'pmticket', 'pmtimetracking');
  }

  /**
   * Test case covering creation of pmtimetrackings.
   */
  public function testpmtimetrackingCreate() {

    // Log in with permission to create test content.
    $user = $this
      ->drupalCreateUser(array(
      'create pmorganization content',
      'create pmproject content',
      'create pmtask content',
      'create pmticket content',
      'create pmtimetracking content',
    ));
    $this
      ->drupalLogin($user);

    // Create test content.
    $org = array(
      'title' => $this
        ->randomName(32),
    );
    $prj = array(
      'title' => $this
        ->randomName(32),
    );
    $task = array(
      'title' => $this
        ->randomName(32),
    );
    $ticket = array(
      'title' => $this
        ->randomName(32),
    );
    $timetracking = array(
      'title' => $this
        ->randomName(32),
    );
    $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'],
    )));
  }

  /**
   * Tests module uninstall path.
   */
  public function testpmtimetrackingUninstall() {
    $module = array(
      'pmtimetracking',
    );
    module_disable($module);
    drupal_uninstall_modules($module);
  }

}

Classes

Namesort descending Description
PMTimetrackingTestCase Define a test case for PM Timetracking.