More updates to stop using dev or alpha or beta versions.
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Test / TestDatabaseTest.php
1 <?php
2
3 namespace Drupal\Tests\Core\Test;
4
5 use Drupal\Core\Test\TestDatabase;
6 use Drupal\Tests\UnitTestCase;
7
8 /**
9  * @coversDefaultClass \Drupal\Core\Test\TestDatabase
10  * @group Template
11  */
12 class TestDatabaseTest extends UnitTestCase {
13
14   /**
15    * @covers ::__construct
16    */
17   public function testConstructorException() {
18     $this->setExpectedException(\InvalidArgumentException::class, "Invalid database prefix: blah1253");
19     new TestDatabase('blah1253');
20   }
21
22   /**
23    * @covers ::__construct
24    * @covers ::getDatabasePrefix
25    * @covers ::getTestSitePath
26    *
27    * @dataProvider providerTestConstructor
28    */
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());
33   }
34
35   /**
36    * Data provider for self::testConstructor()
37    */
38   public function providerTestConstructor() {
39     return [
40       ['test1234', 'test1234', 'sites/simpletest/1234'],
41       ['test123456test234567', 'test123456test234567', 'sites/simpletest/234567']
42     ];
43   }
44
45 }