Files
econom/tests/Unit/MedicationExpenseServiceTest.php
brusnitsyn fb2e6c58e3
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled
first commit
2026-04-06 00:06:00 +09:00

53 lines
1.5 KiB
PHP

<?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);
});