add notes/remark and refactor round-trip
PHP Tests / php-tests (push) Has been cancelled

This commit is contained in:
Nyan Lin Paing
2026-08-22 21:43:41 +07:00
parent 894352b43f
commit fa908cdcaf
46 changed files with 1679 additions and 182 deletions
@@ -33,3 +33,20 @@ test('does not crash if the booking was soft-deleted before this queued listener
expect(fn () => (new MarkBookingPaid)->handle(new PaymentCompleted($payment->fresh())))
->not->toThrow(Throwable::class);
});
test('a round trip: paying the primary leg also confirms its linked return leg', function () {
$outbound = Booking::factory()->create(['status' => BookingStatus::PendingPayment]);
$return = Booking::factory()->create([
'status' => BookingStatus::PendingPayment,
'is_return_leg' => true,
'linked_booking_id' => $outbound->id,
]);
$outbound->update(['linked_booking_id' => $return->id]);
$payment = Payment::factory()->completed()->create(['booking_id' => $outbound->id]);
(new MarkBookingPaid)->handle(new PaymentCompleted($payment));
expect($outbound->refresh()->status)->toBe(BookingStatus::Confirmed)
->and($return->refresh()->status)->toBe(BookingStatus::Confirmed);
});