function DrupalKernelTest::setUp

Sets up unit test environment.

Unlike Drupal\simpletest\WebTestBase::setUp(), UnitTestBase::setUp() does not install modules because tests are performed without accessing the database. Any required files must be explicitly included by the child class setUp() method.

Overrides UnitTestBase::setUp

File

drupal/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php, line 29
Contains Drupal\system\Tests\DrupalKernel\DrupalKernelTest.

Class

DrupalKernelTest
Tests compilation of the DIC.

Namespace

Drupal\system\Tests\DrupalKernel

Code

function setUp() {
  parent::setUp();
  global $conf;
  $conf['php_storage']['service_container'] = array(
    'bin' => 'service_container',
    'class' => 'Drupal\\Component\\PhpStorage\\MTimeProtectedFileStorage',
    'directory' => DRUPAL_ROOT . '/' . $this->public_files_directory . '/php',
    'secret' => drupal_get_hash_salt(),
  );

  // Use a non-persistent cache to avoid queries to non-existing tables.
  $this
    ->settingsSet('cache', array(
    'default' => 'cache.backend.memory',
  ));
}