feat(ticket): add action capability helpers and expose them in admin resource

This commit is contained in:
2026-09-11 09:25:19 -03:00
parent 5d00dc439e
commit 2ddb046c26
4 changed files with 77 additions and 4 deletions

View File

@@ -64,6 +64,24 @@ class TicketTest extends TestCase
$this->assertSame(Ticket::STATUS_ACTIVE, $ticket->status);
}
public function test_it_exposes_admin_action_capabilities(): void
{
$tenant = new Tenant([
'allow_ticket_total_refund' => true,
]);
$active = (new Ticket)->setRelation('tenant', $tenant);
$this->assertTrue($active->is_active());
$this->assertTrue($active->can_cancel());
$this->assertTrue($active->can_refund());
$active->used_at = now();
$this->assertFalse($active->is_active());
$this->assertFalse($active->can_cancel());
$this->assertFalse($active->can_refund());
}
public function test_fixed_window_controls_ticket_validity(): void
{
Carbon::setTestNow('2026-07-21 10:00:00');