function SharedDatabaseStateTest::resetEnvironment

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

Resets the environment after a test method has run.

Overrides KernelTestBase::resetEnvironment

File

core/tests/Drupal/KernelTests/SharedDatabaseStateTest.php, line 63

Class

SharedDatabaseStateTest
Tests the shared database state of Drupal\KernelTests\KernelTestBase.

Namespace

Drupal\KernelTests

Code

protected function resetEnvironment() : void {
  parent::resetEnvironment();
  // ::testStateIsWritable() creates this table. A test method may add to the
  // database schema, and removes what it added here.
  $schema = $this->container
    ->get('database')
    ->schema();
  if ($schema->tableExists(self::CREATED_TABLE)) {
    $schema->dropTable(self::CREATED_TABLE);
  }
}

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