58 lines
1.7 KiB
PHP
58 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Services\Frontend;
|
|
|
|
use App\Services\Frontend\LandingPageParentDashboardService;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Tests\TestCase;
|
|
|
|
class LandingPageParentDashboardServiceTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_summary_returns_parent_payload(): void
|
|
{
|
|
DB::table('configuration')->insert([
|
|
['config_key' => 'school_year', 'config_value' => '2025-2026'],
|
|
['config_key' => 'semester', 'config_value' => 'Fall'],
|
|
]);
|
|
|
|
DB::table('students')->insert([
|
|
'id' => 1,
|
|
'school_id' => 'S-1',
|
|
'firstname' => 'Student',
|
|
'lastname' => 'One',
|
|
'age' => 8,
|
|
'gender' => 'Male',
|
|
'photo_consent' => 1,
|
|
'parent_id' => 1,
|
|
'year_of_registration' => '2025',
|
|
'school_year' => '2025-2026',
|
|
'semester' => 'Fall',
|
|
'is_active' => 1,
|
|
]);
|
|
|
|
DB::table('classSection')->insert([
|
|
'class_id' => 1,
|
|
'class_section_id' => 101,
|
|
'class_section_name' => '1-A',
|
|
'semester' => 'Fall',
|
|
'school_year' => '2025-2026',
|
|
]);
|
|
|
|
DB::table('student_class')->insert([
|
|
'student_id' => 1,
|
|
'class_section_id' => 101,
|
|
'semester' => 'Fall',
|
|
'school_year' => '2025-2026',
|
|
]);
|
|
|
|
$service = app(LandingPageParentDashboardService::class);
|
|
$payload = $service->summary(1, 'primary');
|
|
|
|
$this->assertTrue($payload['ok']);
|
|
$this->assertCount(1, $payload['students']);
|
|
}
|
|
}
|