function NonPublicSchemaTest::tearDown

Same name in other branches
  1. 11.x core/modules/pgsql/tests/src/Kernel/pgsql/NonPublicSchemaTest.php \Drupal\Tests\pgsql\Kernel\pgsql\NonPublicSchemaTest::tearDown()

Overrides KernelTestBase::tearDown

File

core/modules/pgsql/tests/src/Kernel/pgsql/NonPublicSchemaTest.php, line 92

Class

NonPublicSchemaTest
Tests schema API for non-public schema for the PostgreSQL driver.

Namespace

Drupal\Tests\pgsql\Kernel\pgsql

Code

protected function tearDown() : void {
    // We overwrite this function because the regular teardown will not drop the
    // tables from a specified schema.
    $tables = $this->testingFakeConnection
        ->schema()
        ->findTables('%');
    foreach ($tables as $table) {
        if ($this->testingFakeConnection
            ->schema()
            ->dropTable($table)) {
            unset($tables[$table]);
        }
    }
    $this->assertEmpty($this->testingFakeConnection
        ->schema()
        ->findTables('%'));
    Database::removeConnection('testing_fake');
    parent::tearDown();
}

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