You are here

protected function KernelTestBaseTest::setUp in Drupal 8

Performs setup tasks before each individual test method is run.

Overrides KernelTestBase::setUp

File

core/modules/simpletest/src/Tests/KernelTestBaseTest.php, line 28

Class

KernelTestBaseTest
Tests KernelTestBase functionality.

Namespace

Drupal\simpletest\Tests

Code

protected function setUp() {
  $php = <<<'EOS'
<?php
# Make sure that the $test_class variable is defined when this file is included.
if ($test_class) {
}

# Define a function to be able to check that this file was loaded with
# function_exists().
if (!function_exists('simpletest_test_stub_settings_function')) {
  function simpletest_test_stub_settings_function() {}
}
EOS;
  $settings_testing_file = $this->siteDirectory . '/settings.testing.php';
  file_put_contents($settings_testing_file, $php);
  $original_container = $this->originalContainer;
  parent::setUp();
  $this
    ->assertNotIdentical(\Drupal::getContainer(), $original_container, 'KernelTestBase test creates a new container.');
}