function TestDatabaseTest::testConstructorNullPrefix

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

Verify that a test lock is generated if there is no provided prefix.

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

File

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

Class

TestDatabaseTest
@coversDefaultClass \Drupal\Core\Test\TestDatabase

Namespace

Drupal\Tests\Core\Test

Code

public function testConstructorNullPrefix() : void {
    // We use a stub class here because we can't mock getTestLock() so that it's
    // available before the constructor is called.
    $test_db = new TestTestDatabase(NULL);
    $this->assertEquals('test23', $test_db->getDatabasePrefix());
    $this->assertEquals('sites/simpletest/23', $test_db->getTestSitePath());
    $this->assertEquals('sites/simpletest/23/error.log', $test_db->getPhpErrorLogPath());
}

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