3 namespace Drupal\Tests\Core\Test;
5 use Drupal\Core\Test\TestDatabase;
6 use Drupal\Tests\UnitTestCase;
9 * @coversDefaultClass \Drupal\Core\Test\TestDatabase
12 class TestDatabaseTest extends UnitTestCase {
15 * @covers ::__construct
17 public function testConstructorException() {
18 $this->setExpectedException(\InvalidArgumentException::class, "Invalid database prefix: blah1253");
19 new TestDatabase('blah1253');
23 * @covers ::__construct
24 * @covers ::getDatabasePrefix
25 * @covers ::getTestSitePath
27 * @dataProvider providerTestConstructor
29 public function testConstructor($db_prefix, $expected_db_prefix, $expected_site_path) {
30 $test_db = new TestDatabase($db_prefix);
31 $this->assertEquals($expected_db_prefix, $test_db->getDatabasePrefix());
32 $this->assertEquals($expected_site_path, $test_db->getTestSitePath());
36 * Data provider for self::testConstructor()
38 public function providerTestConstructor() {
40 ['test1234', 'test1234', 'sites/simpletest/1234'],
41 ['test123456test234567', 'test123456test234567', 'sites/simpletest/234567']