add school calendar logic
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\Settings\SchoolCalendar;
|
||||
|
||||
use App\Services\Settings\SchoolCalendar\SchoolCalendarMeetingService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SchoolCalendarMeetingServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_list_meetings_filters_for_parent(): void
|
||||
{
|
||||
DB::table('parent_meeting_schedules')->insert([
|
||||
[
|
||||
'student_id' => 1,
|
||||
'parent_user_id' => 10,
|
||||
'parent_name' => 'Parent',
|
||||
'student_name' => 'Student',
|
||||
'class_section_name' => 'Grade 1',
|
||||
'date' => '2026-01-02',
|
||||
'time' => '10:00:00',
|
||||
'notes' => 'Notes',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
'status' => 'scheduled',
|
||||
'created_by' => null,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'student_id' => 2,
|
||||
'parent_user_id' => 11,
|
||||
'parent_name' => 'Other Parent',
|
||||
'student_name' => 'Other Student',
|
||||
'class_section_name' => 'Grade 2',
|
||||
'date' => '2026-01-03',
|
||||
'time' => '11:00:00',
|
||||
'notes' => 'Notes',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
'status' => 'scheduled',
|
||||
'created_by' => null,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
]);
|
||||
|
||||
$service = new SchoolCalendarMeetingService();
|
||||
$rows = $service->listMeetings('2025-2026', 'parent', 10);
|
||||
|
||||
$this->assertCount(1, $rows);
|
||||
$this->assertSame(10, $rows[0]['parent_user_id']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user