function TestDatabaseTest::testConstructor

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Test/TestDatabaseTest.php \Drupal\Tests\Core\Test\TestDatabaseTest::testConstructor()
  2. 10 core/tests/Drupal/Tests/Core/Test/TestDatabaseTest.php \Drupal\Tests\Core\Test\TestDatabaseTest::testConstructor()
  3. 11.x core/tests/Drupal/Tests/Core/Test/TestDatabaseTest.php \Drupal\Tests\Core\Test\TestDatabaseTest::testConstructor()

@covers ::__construct @covers ::getDatabasePrefix @covers ::getTestSitePath

@dataProvider providerTestConstructor

File

core/tests/Drupal/Tests/Core/Test/TestDatabaseTest.php, line 33

Class

TestDatabaseTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Test%21TestDatabase.php/class/TestDatabase/8.9.x" title="Provides helper methods for interacting with the fixture database." class="local">\Drupal\Core\Test\TestDatabase</a>

Namespace

Drupal\Tests\Core\Test

Code

public function testConstructor($db_prefix, $expected_db_prefix, $expected_site_path) {
    $test_db = new TestDatabase($db_prefix);
    $this->assertEquals($expected_db_prefix, $test_db->getDatabasePrefix());
    $this->assertEquals($expected_site_path, $test_db->getTestSitePath());
}

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