You are here

lingotek.access.test in Lingotek Translation 7.5

Declares LingotekAccessFunctionalTest

File

tests/lingotek.access.test
View source
<?php

/**
 * @file
 * Declares LingotekAccessFunctionalTest
 */

/**
 * A class containing access control-related tests.
 */
class LingotekAccessFunctionalTest extends LingotekFunctionalTest {

  /**
   * Meta information about these tests for the test system.
   */
  public static function getInfo() {
    return array(
      'name' => 'Access Control',
      'description' => 'Tests for access control to various Lingotek interface elements.',
      'group' => 'Lingotek',
    );
  }

  /**
   * Tests field access for the Lingotek project override field on node/add forms.
   */
  public function testProjectOverrideProjectAccess() {
    $node_add_path = 'node/add/page';
    $lingotek_html = 'id="edit-lingotek-profile"';

    // Privileged user can see the Lingotek Project override field.
    $this
      ->drupalLogin($this->privileged_user);
    $this
      ->drupalGet($node_add_path);
    $this
      ->assertRaw($lingotek_html);
    $this
      ->drupalLogout();

    // Unprivileged user cannot see the field.
    $this
      ->drupalLogin($this->unprivileged_user);
    $this
      ->drupalGet($node_add_path);
    $this
      ->assertNoRaw($lingotek_html);
    $this
      ->drupalLogout();
  }

}

Classes

Namesort descending Description
LingotekAccessFunctionalTest A class containing access control-related tests.