Fix and adapt tests
This commit is contained in:
parent
ad284208ee
commit
a153c3f594
3 changed files with 43 additions and 44 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue