first commit
This commit is contained in:
5
tests/Unit/ExampleTest.php
Normal file
5
tests/Unit/ExampleTest.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
test('that true is true', function () {
|
||||
expect(true)->toBeTrue();
|
||||
});
|
||||
52
tests/Unit/MedicationExpenseServiceTest.php
Normal file
52
tests/Unit/MedicationExpenseServiceTest.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use App\Services\Reports\MedicationExpenseService;
|
||||
|
||||
test('medication expense service calculates totals and totals without budget', function () {
|
||||
$service = new MedicationExpenseService();
|
||||
|
||||
$totals = $service->calculateFromMatrix([
|
||||
'oms' => [
|
||||
'alcohol' => 100,
|
||||
'narcotic' => 50,
|
||||
'solutions' => 25,
|
||||
'medicines' => 225,
|
||||
'dressing' => 40,
|
||||
],
|
||||
'budget' => [
|
||||
'alcohol' => 10,
|
||||
'narcotic' => 5,
|
||||
'solutions' => 0,
|
||||
'medicines' => 35,
|
||||
'dressing' => 15,
|
||||
],
|
||||
'paid' => [
|
||||
'alcohol' => 20,
|
||||
'narcotic' => 0,
|
||||
'solutions' => 30,
|
||||
'medicines' => 50,
|
||||
'dressing' => 5,
|
||||
],
|
||||
'vmp_oms' => [
|
||||
'alcohol' => 0,
|
||||
'narcotic' => 10,
|
||||
'solutions' => 10,
|
||||
'medicines' => 30,
|
||||
'dressing' => 20,
|
||||
],
|
||||
'vmp_budget' => [
|
||||
'alcohol' => 5,
|
||||
'narcotic' => 5,
|
||||
'solutions' => 5,
|
||||
'medicines' => 5,
|
||||
'dressing' => 10,
|
||||
],
|
||||
]);
|
||||
|
||||
expect($totals['total_without_dressing'])->toBe(620.0)
|
||||
->and($totals['total_dressing'])->toBe(90.0)
|
||||
->and($totals['total_expense'])->toBe(710.0)
|
||||
->and($totals['without_budget_no_dressing'])->toBe(570.0)
|
||||
->and($totals['without_budget_dressing'])->toBe(75.0)
|
||||
->and($totals['without_budget_total'])->toBe(645.0);
|
||||
});
|
||||
12
tests/Unit/ServiceAllocationServiceTest.php
Normal file
12
tests/Unit/ServiceAllocationServiceTest.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
use App\Models\ServiceEntry;
|
||||
|
||||
test('service entry calculates total amount from quantity and unit price', function () {
|
||||
$entry = new ServiceEntry([
|
||||
'quantity' => 2471,
|
||||
'unit_price' => 15.50,
|
||||
]);
|
||||
|
||||
expect($entry->totalAmount())->toBe(38300.5);
|
||||
});
|
||||
Reference in New Issue
Block a user