39 lines
1.5 KiB
PHP
39 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Services\Invoices;
|
|
|
|
use App\Services\Invoices\InvoiceConfigService;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Tests\TestCase;
|
|
|
|
class InvoiceConfigServiceTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_config_service_reads_values(): void
|
|
{
|
|
DB::table('configuration')->insert([
|
|
['config_key' => 'school_year', 'config_value' => '2025-2026'],
|
|
['config_key' => 'semester', 'config_value' => 'Fall'],
|
|
['config_key' => 'due_date', 'config_value' => '2025-09-01'],
|
|
['config_key' => 'grade_fee', 'config_value' => '9'],
|
|
['config_key' => 'first_student_fee', 'config_value' => '350'],
|
|
['config_key' => 'second_student_fee', 'config_value' => '200'],
|
|
['config_key' => 'youth_fee', 'config_value' => '180'],
|
|
['config_key' => 'refund_deadline', 'config_value' => '2025-10-01'],
|
|
]);
|
|
|
|
$service = new InvoiceConfigService;
|
|
|
|
$this->assertSame('2025-2026', $service->getSchoolYear());
|
|
$this->assertSame('Fall', $service->getSemester());
|
|
$this->assertSame('2025-09-01', $service->getDueDate());
|
|
$this->assertSame(9, $service->getGradeFee());
|
|
$this->assertSame(350.0, $service->getFirstStudentFee());
|
|
$this->assertSame(200.0, $service->getSecondStudentFee());
|
|
$this->assertSame(180.0, $service->getYouthFee());
|
|
$this->assertSame('2025-10-01', $service->getRefundDeadline());
|
|
}
|
|
}
|