feat(ticket): add entry reservation handling to ticket refund logic and tests
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
|
||||
namespace Tests\Unit\Ticket;
|
||||
|
||||
use App\Domains\Core\Auth\Models\User;
|
||||
use App\Domains\Commerce\Catalog\Models\CatalogItem;
|
||||
use App\Domains\Commerce\Catalog\Models\Variant;
|
||||
use App\Domains\Core\Auth\Models\User;
|
||||
use App\Domains\Core\Tenant\Models\Tenant;
|
||||
use App\Domains\Ticketing\Desfile\Models\EntryReservation;
|
||||
use App\Domains\Ticketing\Ticket\Enums\ValidityTimeType;
|
||||
use App\Domains\Ticketing\Ticket\Models\Ticket;
|
||||
use App\Domains\Ticketing\Ticket\Models\ValidityTime;
|
||||
@@ -54,6 +55,7 @@ class TicketTest extends TestCase
|
||||
$this->assertInstanceOf(User::class, $ticket->scannerUser()->getRelated());
|
||||
$this->assertInstanceOf(CatalogItem::class, $ticket->sourceCatalogItem()->getRelated());
|
||||
$this->assertInstanceOf(Variant::class, $ticket->sourceVariant()->getRelated());
|
||||
$this->assertInstanceOf(EntryReservation::class, $ticket->entryReservation()->getRelated());
|
||||
}
|
||||
|
||||
public function test_unused_ticket_without_validity_time_is_valid(): void
|
||||
@@ -83,6 +85,21 @@ class TicketTest extends TestCase
|
||||
$this->assertFalse($active->can_refund());
|
||||
}
|
||||
|
||||
public function test_a_ticket_with_an_entry_reservation_cannot_be_refunded(): void
|
||||
{
|
||||
$tenant = new Tenant([
|
||||
'allow_ticket_refund' => true,
|
||||
'allow_ticket_total_refund' => true,
|
||||
]);
|
||||
$ticket = (new Ticket)
|
||||
->setRelation('tenant', $tenant)
|
||||
->setRelation('entryReservation', new EntryReservation);
|
||||
|
||||
$this->assertTrue($ticket->is_active());
|
||||
$this->assertTrue($ticket->allow_refund());
|
||||
$this->assertFalse($ticket->can_refund());
|
||||
}
|
||||
|
||||
public function test_fixed_window_controls_ticket_validity(): void
|
||||
{
|
||||
Carbon::setTestNow('2026-07-21 10:00:00');
|
||||
|
||||
Reference in New Issue
Block a user