Files
alrahma_sunday_school_api/tests/Unit/Services/Semesters/SemesterConfigServiceTest.php
T
2026-06-11 11:46:12 -04:00

28 lines
1012 B
PHP

<?php
namespace Tests\Unit\Services\Semesters;
use App\Services\Semesters\SemesterConfigService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;
class SemesterConfigServiceTest extends TestCase
{
use RefreshDatabase;
public function test_reads_dates_from_configuration(): void
{
DB::table('configuration')->insert([
['id' => 1, 'config_key' => 'fall_semester_start', 'config_value' => '2025-09-01'],
['id' => 2, 'config_key' => 'spring_semester_start', 'config_value' => '2026-01-20'],
['id' => 3, 'config_key' => 'last_school_day', 'config_value' => '2026-06-01'],
]);
$service = new SemesterConfigService;
$this->assertSame('2025-09-01', $service->getFallStart()?->format('Y-m-d'));
$this->assertSame('2026-01-20', $service->getSpringStart()?->format('Y-m-d'));
$this->assertSame('2026-06-01', $service->getLastSchoolDay()?->format('Y-m-d'));
}
}