Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/WalletTest.php
Show All 38 Lines | class WalletTest extends TestCase | ||||
{ | { | ||||
foreach ($this->users as $user) { | foreach ($this->users as $user) { | ||||
$this->deleteTestUser($user); | $this->deleteTestUser($user); | ||||
} | } | ||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
/** | |||||
* Test that turning wallet balance from negative to positive | |||||
* unsuspends the account | |||||
*/ | |||||
public function testBalancePositiveUnsuspend(): void | |||||
{ | |||||
$user = $this->getTestUser('UserWallet1@UserWallet.com'); | |||||
$user->suspend(); | |||||
$wallet = $user->wallets()->first(); | |||||
$wallet->balance = -100; | |||||
$wallet->save(); | |||||
$this->assertTrue($user->isSuspended()); | |||||
$this->assertNotNull($wallet->getSetting('balance_negative_since')); | |||||
$wallet->balance = 100; | |||||
$wallet->save(); | |||||
$this->assertFalse($user->fresh()->isSuspended()); | |||||
$this->assertNull($wallet->getSetting('balance_negative_since')); | |||||
// TODO: Test group account and unsuspending domain/members | |||||
} | |||||
/** | /** | ||||
* Test for Wallet::balanceLastsUntil() | * Test for Wallet::balanceLastsUntil() | ||||
*/ | */ | ||||
public function testBalanceLastsUntil(): void | public function testBalanceLastsUntil(): void | ||||
{ | { | ||||
// Monthly cost of all entitlements: 999 | // Monthly cost of all entitlements: 999 | ||||
// 28 days: 35.68 per day | // 28 days: 35.68 per day | ||||
// 31 days: 32.22 per day | // 31 days: 32.22 per day | ||||
▲ Show 20 Lines • Show All 202 Lines • Show Last 20 Lines |