You are here

public function FillPdfEntityTestCase::setUp in FillPDF 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()

File

tests/FillPdfEntityTestCase.test, line 34

Class

FillPdfEntityTestCase
Tests parsing links for entities.

Code

public function setUp() {

  // Enable any modules required for the test. This should be an array of
  // module names.
  parent::setUp(array(
    'taxonomy',
    'entity',
    'fillpdf',
  ));

  // Create three test nodes with the IDs 1, 2, and 3.
  $nodes = array();
  for ($nid = 1; $nid <= 3; $nid++) {
    $nodes[] = entity_create('node', array(
      'type' => 'article',
      'nid' => $nid,
    ));
  }
  $this->nodes = $nodes;

  // Create three test terms with the IDs 12, 23, and 34.
  $terms = array();
  for ($tid = 11; $tid <= 13; $tid++) {
    $terms[] = entity_create('taxonomy_term', array(
      'vocabulary_machine_name' => 'tags',
      'tid' => $tid,
    ));
  }
  $this->terms = $terms;

  // Create three test users with the IDs 123, 234, and 345.
  $users = array();
  for ($uid = 111; $uid <= 113; $uid++) {
    $users[] = entity_create('user', array(
      'uid' => $uid,
    ));
  }
  $this->users = $users;
}