Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/EntitlementTest.php
Show All 37 Lines | public function tearDown(): void | ||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
/** | /** | ||||
* Test for Entitlement::costsPerDay() | * Test for Entitlement::costsPerDay() | ||||
*/ | */ | ||||
public function testCostsPerDay(): void | public function testCostsPerDay(): void | ||||
{ | { | ||||
// 444 | // 500 | ||||
// 28 days: 15.86 | // 28 days: 17.86 | ||||
// 31 days: 14.32 | // 31 days: 16.13 | ||||
$user = $this->getTestUser('entitlement-test@kolabnow.com'); | $user = $this->getTestUser('entitlement-test@kolabnow.com'); | ||||
$package = Package::where('title', 'kolab')->first(); | $package = Package::where('title', 'kolab')->first(); | ||||
$mailbox = Sku::where('title', 'mailbox')->first(); | $mailbox = Sku::where('title', 'mailbox')->first(); | ||||
$user->assignPackage($package); | $user->assignPackage($package); | ||||
$entitlement = $user->entitlements->where('sku_id', $mailbox->id)->first(); | $entitlement = $user->entitlements->where('sku_id', $mailbox->id)->first(); | ||||
$costsPerDay = $entitlement->costsPerDay(); | $costsPerDay = $entitlement->costsPerDay(); | ||||
$this->assertTrue($costsPerDay < 15.86); | $this->assertTrue($costsPerDay < 17.86); | ||||
$this->assertTrue($costsPerDay > 14.32); | $this->assertTrue($costsPerDay > 16.31); | ||||
} | } | ||||
/** | /** | ||||
* Tests for entitlements | * Tests for entitlements | ||||
* @todo This really should be in User or Wallet tests file | * @todo This really should be in User or Wallet tests file | ||||
*/ | */ | ||||
public function testEntitlements(): void | public function testEntitlements(): void | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |