Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/PaymentsStripeTest.php
Show First 20 Lines • Show All 535 Lines • ▼ Show 20 Lines | public function testTopUpAndWebhook(): void | ||||
$result = PaymentsController::topUpWallet($wallet); | $result = PaymentsController::topUpWallet($wallet); | ||||
$this->assertFalse($result); | $this->assertFalse($result); | ||||
$this->assertCount(1, $wallet->payments()->get()); | $this->assertCount(1, $wallet->payments()->get()); | ||||
// Expect no payment if the top-up amount is not enough | // Expect no payment if the top-up amount is not enough | ||||
$wallet->setSetting('mandate_disabled', null); | $wallet->setSetting('mandate_disabled', null); | ||||
$wallet->balance = -2050; | $wallet->balance = -2050; | ||||
$wallet->save(); | $wallet->save(); | ||||
$result = PaymentsController::topUpWallet($wallet); | $result = PaymentsController::topUpWallet($wallet); | ||||
$this->assertFalse($result); | $this->assertFalse($result); | ||||
$this->assertCount(1, $wallet->payments()->get()); | $this->assertCount(1, $wallet->payments()->get()); | ||||
Bus::assertDispatchedTimes(\App\Jobs\PaymentMandateDisabledEmail::class, 1); | Bus::assertDispatchedTimes(\App\Jobs\PaymentMandateDisabledEmail::class, 1); | ||||
Bus::assertDispatched(\App\Jobs\PaymentMandateDisabledEmail::class, function ($job) use ($wallet) { | Bus::assertDispatched(\App\Jobs\PaymentMandateDisabledEmail::class, function ($job) use ($wallet) { | ||||
$job_wallet = $this->getObjectProperty($job, 'wallet'); | $job_wallet = $this->getObjectProperty($job, 'wallet'); | ||||
return $job_wallet->id === $wallet->id; | return $job_wallet->id === $wallet->id; | ||||
▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines |