Fix support API audit logging
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Tests\Feature\Support;
|
||||
|
||||
use App\Models\BlogCategory;
|
||||
use App\Models\Photo;
|
||||
use App\Models\SuperAdminActionLog;
|
||||
use App\Models\Tenant;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
@@ -130,4 +131,25 @@ class SupportApiTest extends TestCase
|
||||
$response->assertStatus(422)
|
||||
->assertJsonValidationErrors(['title', 'content']);
|
||||
}
|
||||
|
||||
public function test_support_update_logs_audit_entry(): void
|
||||
{
|
||||
$user = User::factory()->create([
|
||||
'role' => 'super_admin',
|
||||
]);
|
||||
|
||||
$tenant = Tenant::factory()->create();
|
||||
|
||||
Sanctum::actingAs($user, ['support-admin', 'support:write']);
|
||||
|
||||
$response = $this->patchJson('/api/v1/support/tenants/'.$tenant->id, [
|
||||
'data' => [
|
||||
'slug' => 'support-updated',
|
||||
],
|
||||
]);
|
||||
|
||||
$response->assertOk();
|
||||
|
||||
$this->assertTrue(SuperAdminActionLog::query()->where('action', 'tenants.updated')->exists());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user