@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/** Clear a manually assigned CLI fixture actor without rotating a user's remember token. */
|
||||
function clearImportQaIdentity(): void
|
||||
{
|
||||
$db = DB::connection();
|
||||
$isolated = ($db->getDriverName() === 'sqlite' && $db->getDatabaseName() === ':memory:')
|
||||
|| ($db->getDriverName() === 'pgsql' && preg_match('/^compras_receipts_test_[a-f0-9]{12}$/D', $db->getDatabaseName()));
|
||||
if (! app()->environment('testing') || ! app()->runningInConsole() || ! $isolated || request()->hasSession()) {
|
||||
throw new LogicException('Only a sessionless disposable CLI fixture actor may be cleared this way.');
|
||||
}
|
||||
auth()->forgetGuards();
|
||||
if (auth()->check()) {
|
||||
throw new LogicException('The synthetic inspection still has an authenticated actor.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user