You are here

protected function KernelTestBase::tearDown in SimpleTest 8.3

Performs cleanup tasks after each individual test method has been run.

Overrides TestBase::tearDown

File

src/KernelTestBase.php, line 310

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\simpletest

Code

protected function tearDown() {
  if ($this->kernel instanceof DrupalKernel) {
    $this->kernel
      ->shutdown();
  }

  // Before tearing down the test environment, ensure that no stream wrapper
  // of this test leaks into the parent environment. Unlike all other global
  // state variables in Drupal, stream wrappers are a global state construct
  // of PHP core, which has to be maintained manually.
  // @todo Move StreamWrapper management into DrupalKernel.
  // @see https://www.drupal.org/node/2028109
  foreach ($this->streamWrappers as $scheme => $type) {
    $this
      ->unregisterStreamWrapper($scheme, $type);
  }
  parent::tearDown();
}