function KernelTestBase::tearDownEnvironment

Same name and namespace in other branches
  1. main core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::tearDownEnvironment()

Cleans the environment up after a test method and checks the result.

Throws

\Throwable Whatever ::resetEnvironment() threw, once the failure is recorded.

File

core/tests/Drupal/KernelTests/KernelTestBase.php, line 914

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

protected function tearDownEnvironment() : void {
  try {
    $this->resetEnvironment();
  } catch (\Throwable $e) {
    if (static::sharesEnvironment() && $this->environmentTables !== NULL) {
      $this->invalidateDatabaseState(sprintf('%s::resetEnvironment() failed: %s', static::class, $e->getMessage()));
    }
    throw $e;
  }
  if (static::sharesEnvironment()) {
    $this->checkSharedDatabaseState();
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.