DatabaseInstallationTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Store\Tests;
6
7
use PHPUnit\Framework\TestCase;
8
9
/**
10
 * @licence GNU GPL v2+
11
 * @author Jeroen De Dauw < [email protected] >
12
 * @author Jonas Kress
13
 */
14
class DatabaseInstallationTest extends TestCase {
15
16
	private $databaseName;
17
	private $tableNames;
18
19
	public function setUp() {
20
		$environment = TestEnvironment::newDefault();
21
		$this->databaseName = $environment->getDatabaseName();
22
		$this->tableNames = $environment->getFactory()->getConnection()->getSchemaManager()->createSchema()->getTableNames();
23
	}
24
25
	/**
26
	 * @dataProvider expectedTableNameProvider
27
	 */
28
	public function testTablesAreCreated( string $tableName ) {
29
		$this->assertContains(
30
			$this->databaseName . '.' . $tableName,
31
			$this->tableNames
32
		);
33
	}
34
35
	public function expectedTableNameProvider() {
36
		yield [ 'address' ];
37
		yield [ 'request' ];
38
		yield [ 'spenden' ];
39
		yield [ 'subscription' ];
40
		yield [ 'donation_payment' ];
41
		yield [ 'donation_payment_sofort' ];
42
	}
43
44
}
45