53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Services\Fees;
|
|
|
|
use App\Services\Fees\FeeConfigService;
|
|
use App\Services\Fees\FeeGradeService;
|
|
use App\Services\Fees\FeeStudentFeeService;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Tests\TestCase;
|
|
|
|
class FeeStudentFeeServiceTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_total_tuition_fee_applies_tiers_and_youth_fee(): void
|
|
{
|
|
DB::table('configuration')->insert([
|
|
['config_key' => 'first_student_fee', 'config_value' => '350'],
|
|
['config_key' => 'second_student_fee', 'config_value' => '200'],
|
|
['config_key' => 'youth_fee', 'config_value' => '180'],
|
|
]);
|
|
|
|
DB::table('classSection')->insert([
|
|
[
|
|
'id' => 1,
|
|
'class_id' => 1,
|
|
'class_section_id' => 101,
|
|
'class_section_name' => '3',
|
|
'semester' => 'Fall',
|
|
'school_year' => '2025-2026',
|
|
],
|
|
[
|
|
'id' => 2,
|
|
'class_id' => 2,
|
|
'class_section_id' => 102,
|
|
'class_section_name' => '10',
|
|
'semester' => 'Fall',
|
|
'school_year' => '2025-2026',
|
|
],
|
|
]);
|
|
|
|
$service = new FeeStudentFeeService(new FeeGradeService(), new FeeConfigService());
|
|
|
|
$total = $service->totalTuitionFee([
|
|
['class_section_id' => 101],
|
|
['class_section_id' => 102],
|
|
]);
|
|
|
|
$this->assertSame(530.0, $total);
|
|
}
|
|
}
|