Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/EntitlementTest.php
Show All 34 Lines | public function tearDown(): void | ||||
$this->deleteTestUser('entitled-user@custom-domain.com'); | $this->deleteTestUser('entitled-user@custom-domain.com'); | ||||
$this->deleteTestGroup('test-group@custom-domain.com'); | $this->deleteTestGroup('test-group@custom-domain.com'); | ||||
$this->deleteTestDomain('custom-domain.com'); | $this->deleteTestDomain('custom-domain.com'); | ||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
/** | /** | ||||
* Test for Entitlement::costsPerDay() | |||||
*/ | |||||
public function testCostsPerDay(): void | |||||
{ | |||||
// 500 | |||||
// 28 days: 17.86 | |||||
// 31 days: 16.129 | |||||
$user = $this->getTestUser('entitlement-test@kolabnow.com'); | |||||
$package = Package::withEnvTenantContext()->where('title', 'kolab')->first(); | |||||
$mailbox = Sku::withEnvTenantContext()->where('title', 'mailbox')->first(); | |||||
$user->assignPackage($package); | |||||
$entitlement = $user->entitlements->where('sku_id', $mailbox->id)->first(); | |||||
$costsPerDay = $entitlement->costsPerDay(); | |||||
$this->assertTrue($costsPerDay < 17.86); | |||||
$this->assertTrue($costsPerDay > 16.12); | |||||
} | |||||
/** | |||||
* 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 | ||||
{ | { | ||||
$packageDomain = Package::withEnvTenantContext()->where('title', 'domain-hosting')->first(); | $packageDomain = Package::withEnvTenantContext()->where('title', 'domain-hosting')->first(); | ||||
$packageKolab = Package::withEnvTenantContext()->where('title', 'kolab')->first(); | $packageKolab = Package::withEnvTenantContext()->where('title', 'kolab')->first(); | ||||
▲ Show 20 Lines • Show All 153 Lines • Show Last 20 Lines |