* Database config is juggled so the value can be restored when
* parallel testing are used, where multiple databases exist.
*/
- protected function runWithEnv(string $name, $value, callable $callback)
+ protected function runWithEnv(string $name, $value, callable $callback, bool $handleDatabase = true)
{
Env::disablePutenv();
$originalVal = $_SERVER[$name] ?? null;
$database = config('database.connections.mysql_testing.database');
$this->refreshApplication();
- DB::purge();
- config()->set('database.connections.mysql_testing.database', $database);
- DB::beginTransaction();
+ if ($handleDatabase) {
+ DB::purge();
+ config()->set('database.connections.mysql_testing.database', $database);
+ DB::beginTransaction();
+ }
$callback();
- DB::rollBack();
+ if ($handleDatabase) {
+ DB::rollBack();
+ }
if (is_null($originalVal)) {
unset($_SERVER[$name]);
$detailsToCheck = ['type' => $type];
if ($entity) {
- $detailsToCheck['entity_type'] = $entity->getMorphClass();
- $detailsToCheck['entity_id'] = $entity->id;
+ $detailsToCheck['loggable_type'] = $entity->getMorphClass();
+ $detailsToCheck['loggable_id'] = $entity->id;
}
if ($detail) {