ramadanproject/tests/Feature/PaymentChargeTest.php
Ahmed Darrazi 45a147253c
Some checks failed
tests / ci (push) Failing after 6m13s
linter / quality (pull_request) Failing after 58s
linter / quality (push) Failing after 1m19s
tests / ci (pull_request) Failing after 5m28s
feat(public-grid): add QA, quickstart, decision docs; scheduler docs; ignore files; tasks updates; run pint
2026-01-03 04:56:12 +01:00

23 lines
748 B
PHP

<?php
use App\Models\MasterImage;
use App\Models\Reservation;
use Illuminate\Support\Facades\Bus;
it('charges and confirms a reservation and dispatches composite job', function () {
MasterImage::create(['path' => 'master.png', 'version' => 1]);
$res = Reservation::create(['x' => 0, 'y' => 0, 'w' => 2, 'h' => 2, 'status' => 'held', 'reserved_until' => now()->addMinutes(5)]);
Bus::fake();
$response = $this->postJson('/api/payment/charge', ['reservation_id' => $res->id]);
$response->assertSuccessful();
expect(Reservation::find($res->id)->status)->toBe('confirmed');
Bus::assertDispatched(App\Jobs\CompositeImage::class, function ($job) use ($res) {
return $job->reservationId === $res->id;
});
});