function TestDatabaseTest::testConstructor

Same name and namespace in other branches
  1. 11.x 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. 9 core/tests/Drupal/Tests/Core/Test/TestDatabaseTest.php \Drupal\Tests\Core\Test\TestDatabaseTest::testConstructor()
  4. 8.9.x core/tests/Drupal/Tests/Core/Test/TestDatabaseTest.php \Drupal\Tests\Core\Test\TestDatabaseTest::testConstructor()

Tests constructor.

@legacy-covers ::__construct @legacy-covers ::getDatabasePrefix @legacy-covers ::getTestSitePath @legacy-covers ::getPhpErrorLogPath

Attributes

#[DataProvider('providerTestConstructor')]

File

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

Class

TestDatabaseTest
Tests Drupal\Core\Test\TestDatabase.

Namespace

Drupal\Tests\Core\Test

Code

public function testConstructor($db_prefix, $expected_db_prefix, $expected_site_path) : void {
  $test_db = new TestDatabase($db_prefix);
  $this->assertEquals($expected_db_prefix, $test_db->getDatabasePrefix());
  $this->assertEquals($expected_site_path, $test_db->getTestSitePath());
  $this->assertEquals($expected_site_path . '/error.log', $test_db->getPhpErrorLogPath());
}

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