Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Jobs/WalletCheckTest.php
Show First 20 Lines • Show All 219 Lines • ▼ Show 20 Lines | public function testHandleSuspended(): void | ||||
$wallet->setSetting('balance_negative_since', $now->subDays($days)->toDateTimeString()); | $wallet->setSetting('balance_negative_since', $now->subDays($days)->toDateTimeString()); | ||||
$job = new WalletCheck($wallet); | $job = new WalletCheck($wallet); | ||||
$job->handle(); | $job->handle(); | ||||
// Assert the mail was sent to the user's email, but not to his external email | // Assert the mail was sent to the user's email, but not to his external email | ||||
Mail::assertSent(\App\Mail\NegativeBalanceSuspended::class, 1); | Mail::assertSent(\App\Mail\NegativeBalanceSuspended::class, 1); | ||||
Mail::assertSent(\App\Mail\NegativeBalanceSuspended::class, function ($mail) use ($user) { | Mail::assertSent(\App\Mail\NegativeBalanceSuspended::class, function ($mail) use ($user) { | ||||
return $mail->hasTo($user->email) && !$mail->hasCc('external@test.com'); | return $mail->hasTo($user->email) && $mail->hasCc('external@test.com'); | ||||
}); | }); | ||||
// Check that it has been suspended | // Check that it has been suspended | ||||
$this->assertTrue($user->fresh()->isSuspended()); | $this->assertTrue($user->fresh()->isSuspended()); | ||||
// TODO: Test that group account members/domain are also being suspended | // TODO: Test that group account members/domain are also being suspended | ||||
/* | /* | ||||
foreach ($wallet->entitlements()->fresh()->get() as $entitlement) { | foreach ($wallet->entitlements()->fresh()->get() as $entitlement) { | ||||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |