Fix support API audit logging
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-28 21:02:25 +01:00
parent f0e8cee850
commit 0d2759b0d4
6 changed files with 308 additions and 143 deletions

View File

@@ -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());
}
}