Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/PlanTest.php
Show All 19 Lines | class PlanTest extends TestCase | ||||
} | } | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function tearDown(): void | public function tearDown(): void | ||||
{ | { | ||||
Plan::where('title', 'test-plan')->delete(); | Plan::where('title', 'test-plan')->delete(); | ||||
parent::tearDown(); | |||||
} | } | ||||
/** | /** | ||||
* Tests for plan attributes localization | * Tests for plan attributes localization | ||||
*/ | */ | ||||
public function testPlanLocalization(): void | public function testPlanLocalization(): void | ||||
{ | { | ||||
$plan = Plan::create([ | $plan = Plan::create([ | ||||
Show All 37 Lines | public function testHasDomain(): void | ||||
$plan = Plan::where('title', 'individual')->first(); | $plan = Plan::where('title', 'individual')->first(); | ||||
$this->assertTrue($plan->hasDomain() === false); | $this->assertTrue($plan->hasDomain() === false); | ||||
$plan = Plan::where('title', 'group')->first(); | $plan = Plan::where('title', 'group')->first(); | ||||
$this->assertTrue($plan->hasDomain() === true); | $this->assertTrue($plan->hasDomain() === true); | ||||
} | } | ||||
/** | |||||
* Test for a plan's cost. | |||||
*/ | |||||
public function testCost(): void | |||||
{ | |||||
$plan = Plan::where('title', 'individual')->first(); | |||||
$package_costs = 0; | |||||
foreach ($plan->packages as $package) { | |||||
$package_costs += $package->cost(); | |||||
} | |||||
$this->assertTrue( | |||||
$package_costs == 999, | |||||
"The total costs of all packages for this plan is not 9.99" | |||||
); | |||||
$this->assertTrue( | |||||
$plan->cost() == 999, | |||||
"The total costs for this plan is not 9.99" | |||||
); | |||||
$this->assertTrue($plan->cost() == $package_costs); | |||||
} | |||||
} | } |