function ToolkitTestBase::setUp

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 Drupal\simpletest\WebTestBase::$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 WebTestBase::setUp

See also

Drupal\simpletest\WebTestBase::prepareDatabasePrefix()

Drupal\simpletest\WebTestBase::changeDatabasePrefix()

Drupal\simpletest\WebTestBase::prepareEnvironment()

1 call to ToolkitTestBase::setUp()
ImageEffectsTest::setUp in drupal/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php
Sets up a Drupal site for running functional and integration tests.
1 method overrides ToolkitTestBase::setUp()
ImageEffectsTest::setUp in drupal/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php
Sets up a Drupal site for running functional and integration tests.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php, line 30
Definition of Drupal\system\Tests\Image\ToolkitTestBase.

Class

ToolkitTestBase
Base class for image manipulation testing.

Namespace

Drupal\system\Tests\Image

Code

function setUp() {
  parent::setUp();

  // Use the image_test.module's test toolkit.
  $manager = new ImageToolkitManager($this->container
    ->get('container.namespaces'));
  $this->toolkit = $manager
    ->createInstance('test');

  // Pick a file for testing.
  $file = current($this
    ->drupalGetTestFiles('image'));
  $this->file = $file->uri;

  // Setup a dummy image to work with, this replicate image_load() so we
  // can avoid calling it.
  $this->image = new stdClass();
  $this->image->source = $this->file;
  $this->image->info = image_get_info($this->file);
  $this->image->toolkit = $this->toolkit;

  // Clear out any hook calls.
  $this
    ->imageTestReset();
}