You are here

function RelationTestCase::setUp in Relation 7

Sets up a Drupal site for running functional and integration tests.

Generates a random database prefix and installs Drupal with the specified installation profile in DrupalWebTestCase::$profile into the prefixed database. Afterwards, installs any additional modules specified by the test.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Parameters

...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.

Overrides DrupalWebTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

7 calls to RelationTestCase::setUp()
RelationAPITestCase::setUp in tests/relation.test
Sets up a Drupal site for running functional and integration tests.
RelationDummyFieldTestCase::setUp in relation_dummy_field/tests/relation_dummy_field.test
Sets up a Drupal site for running functional and integration tests.
RelationEntityCollectorTestCase::setUp in relation_entity_collector/tests/relation_entity_collector.test
Sets up a Drupal site for running functional and integration tests.
RelationMigrateTestCase::setUp in relation_migrate/tests/relation.migrate.test
Sets up a Drupal site for running functional and integration tests.
RelationRulesTestCase::setUp in tests/relation.rules.test
Sets up a Drupal site for running functional and integration tests.

... See full list

7 methods override RelationTestCase::setUp()
RelationAPITestCase::setUp in tests/relation.test
Sets up a Drupal site for running functional and integration tests.
RelationDummyFieldTestCase::setUp in relation_dummy_field/tests/relation_dummy_field.test
Sets up a Drupal site for running functional and integration tests.
RelationEntityCollectorTestCase::setUp in relation_entity_collector/tests/relation_entity_collector.test
Sets up a Drupal site for running functional and integration tests.
RelationMigrateTestCase::setUp in relation_migrate/tests/relation.migrate.test
Sets up a Drupal site for running functional and integration tests.
RelationRulesTestCase::setUp in tests/relation.rules.test
Sets up a Drupal site for running functional and integration tests.

... See full list

File

tests/relation.test, line 14
Tests for Relation module.

Class

RelationTestCase
Relation helper class.

Code

function setUp() {

  // Other modules will reuse this class, make sure to pass the arguments up.
  if (func_num_args()) {
    parent::setUp(func_get_args());
  }
  else {
    parent::setUp('relation');
  }

  // Defines users and permissions.
  $permissions = array(
    'create article content',
    'create page content',
    'administer relation types',
    'administer relations',
    'administer fields',
    'use relation import',
    'access relations',
    'create relations',
    'edit relations',
    'delete relations',
  );
  $this->web_user = $this
    ->drupalCreateUser($permissions);
  $this
    ->drupalLogin($this->web_user);

  // Defines entities.
  $this
    ->createRelationNodes();
  $this
    ->createRelationUsers();

  // Defines relation types.
  $this
    ->createRelationTypes();

  // Defines end points.
  $this
    ->createRelationEndPoints();

  // Defines relations.
  $this
    ->createRelationSymmetric();
  $this
    ->createRelationDirectional();
  $this
    ->createRelationOctopus();
  $this
    ->createRelationUnary();
}