17 lines
468 B
PHP
17 lines
468 B
PHP
<?php
|
|
|
|
namespace Tests\Support;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Support\Facades\Crypt;
|
|
|
|
trait AuthenticatesQaActors
|
|
{
|
|
protected function actingAsWithMfa(User $actor): static
|
|
{
|
|
$actor->forceFill(['two_factor_secret' => Crypt::encryptString('SYNTHETIC-QA'), 'two_factor_confirmed_at' => now()])->save();
|
|
|
|
return $this->actingAs($actor)->withSession(['login.id' => null, 'portal.mfa_actor' => $actor->id, 'portal.mfa_at' => time()]);
|
|
}
|
|
}
|