function KernelTestBaseDatabaseDriverModuleTest::testDatabaseDriverModuleEnabled

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/KernelTestBaseDatabaseDriverModuleTest.php \Drupal\KernelTests\KernelTestBaseDatabaseDriverModuleTest::testDatabaseDriverModuleEnabled()
  2. 11.x core/tests/Drupal/KernelTests/KernelTestBaseDatabaseDriverModuleTest.php \Drupal\KernelTests\KernelTestBaseDatabaseDriverModuleTest::testDatabaseDriverModuleEnabled()

@covers ::bootEnvironment

File

core/tests/Drupal/KernelTests/KernelTestBaseDatabaseDriverModuleTest.php, line 56

Class

KernelTestBaseDatabaseDriverModuleTest
@coversDefaultClass <a href="/api/drupal/core%21tests%21Drupal%21KernelTests%21KernelTestBase.php/class/KernelTestBase/10" title="Base class for functional integration tests." class="local">\Drupal\KernelTests\KernelTestBase</a>

Namespace

Drupal\KernelTests

Code

public function testDatabaseDriverModuleEnabled() : void {
    $driver = Database::getConnection()->driver();
    if (!in_array($driver, [
        'DrivertestMysql',
        'DrivertestPgsql',
    ])) {
        $this->markTestSkipped("This test does not support the {$driver} database driver.");
    }
    // Test that the module that is providing the database driver is enabled.
    $this->assertSame(1, \Drupal::service('extension.list.module')->get('driver_test')->status);
}

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