You are here

function CasTestHelper::setUp in CAS 7

Same name and namespace in other branches
  1. 6.3 cas.test \CasTestHelper::setUp()

Helper class for CAS tests.

Creates an administrative user and downloads phpCAS.

Overrides DrupalWebTestCase::setUp

2 calls to CasTestHelper::setUp()
CasGatewayTestCase::setUp in ./cas.test
Helper class for CAS tests.
CasLoginBlockTestCase::setUp in ./cas.test
Helper class for CAS tests.
2 methods override CasTestHelper::setUp()
CasGatewayTestCase::setUp in ./cas.test
Helper class for CAS tests.
CasLoginBlockTestCase::setUp in ./cas.test
Helper class for CAS tests.

File

./cas.test, line 16
Tests for cas.module.

Class

CasTestHelper
@file Tests for cas.module.

Code

function setUp() {

  // Install modules needed for this test. This could have been passed in as
  // either a single array argument or a variable number of string arguments.
  // @todo Remove this compatibility layer in Drupal 8, and only accept
  // $modules as a single array argument.
  $modules = func_get_args();
  if (isset($modules[0]) && is_array($modules[0])) {
    $modules = $modules[0];
  }

  // cas_test requires the CAS Server module.
  $modules = array_merge(array(
    'cas',
    'cas_test',
    'cas_server',
  ), $modules);
  parent::setUp($modules);

  // Tests will fail unless clean URLs are enabled, due to an incompatibility
  // in phpCAS.
  variable_set('clean_url', TRUE);

  // Set CAS server url (will be altered).
  variable_set('cas_server', 'example.com');

  // Create admin user.
  $this->admin_user = $this
    ->drupalCreateUser(array(
    'administer users',
    'administer cas',
  ));

  // Download and extract in PHPCAS.
  $this
    ->downloadExtractPhpCas('1.3.3');
}