You are here

pm.test in Drupal PM (Project Management) 7.3

Same filename and directory in other branches
  1. 8 pm.test
  2. 7 pm.test
  3. 7.2 pm.test

Test definitions for Project Management.

File

pm.test
View source
<?php

/**
 * @file
 * Test definitions for Project Management.
 */

/**
 * Define a test case for Project Management.
 */
class PMTestCase extends DrupalWebTestCase {

  /**
   * Returns meta data for Project Management tests.
   */
  public static function getInfo() {
    return array(
      'name' => 'Project Management functionality',
      'description' => 'Test the functionality of the Project Management base module',
      'group' => 'Project Management',
    );
  }

  /**
   * Standard set up for all tests.
   */
  public function setUp() {
    parent::setUp('pm');
  }

  /**
   * Tests access to Project Management pages.
   */
  public function testpmAccess() {
    $this
      ->drupalGet('pm');
    $this
      ->assertResponse(403, t('Make sure access is denied to Project Management dashboard for anonymous user'));
    $basic_user = $this
      ->drupalCreateUser();
    $this
      ->drupalLogin($basic_user);
    $this
      ->drupalGet('pm');
    $this
      ->assertResponse(403, t('Make sure access is denied to Project Management dashboard for basic user'));
    $privileged_user = $this
      ->drupalCreateUser(array(
      'Project Management: access dashboard',
    ));
    $this
      ->drupalLogin($privileged_user);
    $this
      ->drupalGet('pm');
    $this
      ->assertText(t('Project Management'), t('Make sure the correct page has been displayed by checking that the title is "Project Management".'));
  }

  /**
   * Tests access to Project Management settings pages.
   */
  public function testpmAccessSettings() {
    $this
      ->drupalGet('admin/config/pm');
    $this
      ->assertResponse(403, t('Make sure access is denied to Project Management settings page for anonymous user'));
    $this
      ->drupalGet('admin/config/pm/pm');
    $this
      ->assertResponse(403, t('Make sure access is denied to Project Management settings page for anonymous user'));
    $basic_user = $this
      ->drupalCreateUser();
    $this
      ->drupalLogin($basic_user);
    $this
      ->drupalGet('admin/config/pm');
    $this
      ->assertResponse(403, t('Make sure access is denied to Project Management settings page for basic user'));
    $this
      ->drupalGet('admin/config/pm/pm');
    $this
      ->assertResponse(403, t('Make sure access is denied to Project Management settings page for basic user'));
    $privileged_user = $this
      ->drupalCreateUser(array(
      'Project Management: access administration pages',
    ));
    $this
      ->drupalLogin($privileged_user);
    $this
      ->drupalGet('admin/config/pm');
    $this
      ->assertText(t('Project Management'), t('Make sure the correct page has been displayed by checking that the title of the settings page is "Project Management".'));
    $this
      ->drupalGet('admin/config/pm/pm');
    $this
      ->assertText(t('Project Management'), t('Make sure the correct page has been displayed by checking that the title of the settings page is "Project Management".'));
  }

  /**
   * Tests module uninstall path.
   */
  public function testpmUninstall() {
    $module = array(
      'pm',
    );
    module_disable($module);
    $result = drupal_uninstall_modules($module);
    $this
      ->AssertTrue($result, t('Module successfully uninstalled.'));
  }

  /**
   * Tests compatibility between submodules.
   */
  public function testpmEnableAll() {
    $submodules = array(
      'pmexpense',
      'pmissue',
      'pmnote',
      'pmorganization',
      'pmperson',
      'pmproject',
      'pmtask',
      'pmteam',
      'pmticket',
      'pmtimetracking',
    );
    $result = module_enable($submodules, TRUE);
    $this
      ->assertTrue($result, t('Modules enabled successfully.'));
  }

}

Classes

Namesort descending Description
PMTestCase Define a test case for Project Management.