Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/BillingTest.php
Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | public function testAddtStorageEarly(): void | ||||
); | ); | ||||
$this->assertEquals(999, $this->wallet->expectedCharges()); | $this->assertEquals(999, $this->wallet->expectedCharges()); | ||||
$sku = \App\Sku::where(['title' => 'storage'])->first(); | $sku = \App\Sku::where(['title' => 'storage'])->first(); | ||||
$entitlement = \App\Entitlement::create( | $entitlement = \App\Entitlement::create( | ||||
[ | [ | ||||
'owner_id' => $this->user->id, | |||||
'wallet_id' => $this->wallet_id, | 'wallet_id' => $this->wallet_id, | ||||
'sku_id' => $sku->id, | 'sku_id' => $sku->id, | ||||
'cost' => $sku->cost, | 'cost' => $sku->cost, | ||||
'entitleable_id' => $this->user->id, | 'entitleable_id' => $this->user->id, | ||||
'entitleable_type' => \App\User::class | 'entitleable_type' => \App\User::class | ||||
] | ] | ||||
); | ); | ||||
Show All 14 Lines | public function testAddtStorageLate(): void | ||||
$this->backdateEntitlements($this->wallet->entitlements, Carbon::now()->subMonths(1)); | $this->backdateEntitlements($this->wallet->entitlements, Carbon::now()->subMonths(1)); | ||||
$this->assertEquals(999, $this->wallet->expectedCharges()); | $this->assertEquals(999, $this->wallet->expectedCharges()); | ||||
$sku = \App\Sku::where(['title' => 'storage'])->first(); | $sku = \App\Sku::where(['title' => 'storage'])->first(); | ||||
$entitlement = \App\Entitlement::create( | $entitlement = \App\Entitlement::create( | ||||
[ | [ | ||||
'owner_id' => $this->user->id, | |||||
'wallet_id' => $this->wallet_id, | 'wallet_id' => $this->wallet_id, | ||||
'sku_id' => $sku->id, | 'sku_id' => $sku->id, | ||||
'cost' => $sku->cost, | 'cost' => $sku->cost, | ||||
'entitleable_id' => $this->user->id, | 'entitleable_id' => $this->user->id, | ||||
'entitleable_type' => \App\User::class | 'entitleable_type' => \App\User::class | ||||
] | ] | ||||
); | ); | ||||
Show All 28 Lines | public function testSecondMonth(): void | ||||
$this->assertCount(4, $this->wallet->entitlements); | $this->assertCount(4, $this->wallet->entitlements); | ||||
$this->assertEquals(1998, $this->wallet->expectedCharges()); | $this->assertEquals(1998, $this->wallet->expectedCharges()); | ||||
$sku = \App\Sku::where(['title' => 'storage'])->first(); | $sku = \App\Sku::where(['title' => 'storage'])->first(); | ||||
$entitlement = \App\Entitlement::create( | $entitlement = \App\Entitlement::create( | ||||
[ | [ | ||||
'owner_id' => $this->user->id, | |||||
'entitleable_id' => $this->user->id, | 'entitleable_id' => $this->user->id, | ||||
'entitleable_type' => \App\User::class, | 'entitleable_type' => \App\User::class, | ||||
'cost' => $sku->cost, | 'cost' => $sku->cost, | ||||
'sku_id' => $sku->id, | 'sku_id' => $sku->id, | ||||
'wallet_id' => $this->wallet_id | 'wallet_id' => $this->wallet_id | ||||
] | ] | ||||
); | ); | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |