mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 07:50:24 +08:00
Using a different setting key now, so that it won't break tests whenever you re-run them once smtp is set.
Fixed, badly, the test to create users etc caused by the prepareDatabase flushing all settings by default.
This commit is contained in:
parent
f686fd3e57
commit
f47d739aac
@ -82,12 +82,26 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
|
||||
|
||||
// First, truncate all referenced tables so that they are empty.
|
||||
foreach (array_keys($tableData) as $table) {
|
||||
$this->database()->table($table)->truncate();
|
||||
if ($table !== 'settings') {
|
||||
$this->database()->table($table)->truncate();
|
||||
}
|
||||
}
|
||||
|
||||
// Then, insert all rows required for this test case.
|
||||
foreach ($tableData as $table => $rows) {
|
||||
$this->database()->table($table)->insert($rows);
|
||||
foreach ($rows as $row) {
|
||||
if ($table === 'settings') {
|
||||
$this->database()->table($table)->updateOrInsert(
|
||||
['key' => $row['key']],
|
||||
$row
|
||||
);
|
||||
} else {
|
||||
$this->database()->table($table)->updateOrInsert(
|
||||
isset($row['id']) ? ['id' => $row['id']] : $row,
|
||||
$row
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// And finally, turn on foreign key checks again.
|
||||
|
Loading…
x
Reference in New Issue
Block a user