Passed
Push — master ( e32ade...233249 )
by Jeroen De
03:39
created

DatabaseInstallationTest::testGetTablesAreThere()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
rs 9.3142
cc 1
eloc 14
nc 1
nop 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A DatabaseInstallationTest::setUp() 0 5 1
A DatabaseInstallationTest::testTablesAreCreated() 0 6 1
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 [ 'action_log' ];
37
		yield [ 'address' ];
38
		yield [ 'backend_banner' ];
39
		yield [ 'backend_impressions' ];
40
		yield [ 'request' ];
41
		yield [ 'spenden' ];
42
		yield [ 'subscription' ];
43
		yield [ 'users' ];
44
		yield [ 'donation_payment' ];
45
		yield [ 'donation_payment_sofort' ];
46
	}
47
48
}
49