feat(tests): enhance AdminAppTicketEventScopeTest with soft deletes and active ticket filtering

This commit is contained in:
2026-10-01 09:47:32 -03:00
parent 22de61c8c0
commit 3ddff7e0ee
2 changed files with 11 additions and 2 deletions

View File

@@ -75,6 +75,7 @@ class AdminAppTicketEventScopeTest extends TestCase
Schema::create('desfile_entry_reservations', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('ticket_id');
$table->softDeletes();
});
Schema::create('value_changes', function (Blueprint $table): void {
$table->id();
@@ -114,6 +115,10 @@ class AdminAppTicketEventScopeTest extends TestCase
// Status uses sorting in memory rather than the database.
$this->getJson('/api/v1/adminapp/tenant/tickets?sort_by=status')
->assertOk()->assertJsonCount(1, 'data')->assertJsonPath('data.0.id', 1);
DB::table('tickets')->where('id', 1)->update(['used_at' => null]);
$this->getJson('/api/v1/adminapp/tenant/tickets?status=active')
->assertOk()->assertJsonCount(1, 'data')
->assertJsonPath('scanned_tickets', 0)->assertJsonPath('total_tickets', 1);
}
public function test_foreign_unassigned_and_other_tenant_tickets_cannot_be_modified_or_refunded(): void
@@ -156,7 +161,7 @@ class AdminAppTicketEventScopeTest extends TestCase
fn ($tenant, Collection $tickets, $timezone): bool => $tenant->codigo === 'onticket'
&& $tickets->pluck('id')->all() === [1] && $timezone === 'UTC'
)->andReturn($class === AdminAppTicketPdfService::class
? response('pdf') : new StreamedResponse(fn () => print('excel')));
? response('pdf') : new StreamedResponse(fn () => print ('excel')));
});
}
foreach (['pdf', 'excel'] as $format) {