function KernelTestBase::checkSharedDatabaseState

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

Checks the shared database state after a test method has run.

File

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

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

private function checkSharedDatabaseState() : void {
  if ($this->environmentTables === NULL) {
    // The test method never reached the point where the environment is
    // known, for example because ::setUp() skipped it before the test
    // database connection was set up, so there is nothing to compare
    // against. Anything left behind is dropped once the test class finishes.
    return;
  }
  try {
    $this->checkNoSharedTableWasDropped();
    $this->checkNoTableWasLeftBehind();
  } catch (\Throwable $e) {
    $this->invalidateDatabaseState($e->getMessage());
    throw $e;
  }
}

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