1
0
Fork 0

Fix and adapt tests

This commit is contained in:
Philipp Holzer 2023-02-12 13:09:14 +01:00
commit a153c3f594
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
3 changed files with 43 additions and 44 deletions

View file

@ -53,16 +53,14 @@ trait DatabaseTestTrait
/**
* Loads a given DB fixture for this DB test
*
* @param string $fixture The path to the fixture
* @param string[][] $fixture The fixture array
* @param Database $dba The DB connection
*
* @throws \Exception
*/
protected function loadFixture(string $fixture, Database $dba)
protected function loadDirectFixture(array $fixture, Database $dba)
{
$data = include $fixture;
foreach ($data as $tableName => $rows) {
foreach ($fixture as $tableName => $rows) {
if (is_numeric($tableName)) {
continue;
}
@ -77,4 +75,19 @@ trait DatabaseTestTrait
}
}
}
/**
* Loads a given DB fixture-file for this DB test
*
* @param string $fixture The path to the fixture
* @param Database $dba The DB connection
*
* @throws \Exception
*/
protected function loadFixture(string $fixture, Database $dba)
{
$data = include $fixture;
$this->loadDirectFixture($data, $dba);
}
}