Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/WalletTest.php
Show First 20 Lines • Show All 593 Lines • ▼ Show 20 Lines | public function testChargeAndDeleteEntitlementsTrial(): void | ||||
*/ | */ | ||||
} | } | ||||
/** | /** | ||||
* Tests for award() and penalty() | * Tests for award() and penalty() | ||||
*/ | */ | ||||
public function testAwardAndPenalty(): void | public function testAwardAndPenalty(): void | ||||
{ | { | ||||
$this->markTestIncomplete(); | $user = $this->getTestUser('UserWallet1@UserWallet.com'); | ||||
$wallet = $user->wallets()->first(); | |||||
// Test award | |||||
$this->assertSame($wallet->id, $wallet->award(100, 'test')->id); | |||||
$this->assertSame(100, $wallet->balance); | |||||
$this->assertSame(100, $wallet->fresh()->balance); | |||||
$transaction = $wallet->transactions()->first(); | |||||
$this->assertSame(100, $transaction->amount); | |||||
$this->assertSame(Transaction::WALLET_AWARD, $transaction->type); | |||||
$this->assertSame('test', $transaction->description); | |||||
$wallet->transactions()->delete(); | |||||
// Test penalty | |||||
$this->assertSame($wallet->id, $wallet->penalty(100, 'test')->id); | |||||
$this->assertSame(0, $wallet->balance); | |||||
$this->assertSame(0, $wallet->fresh()->balance); | |||||
$transaction = $wallet->transactions()->first(); | |||||
$this->assertSame(-100, $transaction->amount); | |||||
$this->assertSame(Transaction::WALLET_PENALTY, $transaction->type); | |||||
$this->assertSame('test', $transaction->description); | |||||
} | } | ||||
/** | /** | ||||
* Tests for chargeback() and refund() | * Tests for chargeback() and refund() | ||||
*/ | */ | ||||
public function testChargebackAndRefund(): void | public function testChargebackAndRefund(): void | ||||
{ | { | ||||
$this->markTestIncomplete(); | $this->markTestIncomplete(); | ||||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |