add all controllers logic
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\ClassSections;
|
||||
|
||||
use App\Services\ClassSections\ClassSectionQueryService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ClassSectionQueryServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_list_filters_by_search(): void
|
||||
{
|
||||
DB::table('classes')->insert([
|
||||
'class_name' => 'Class 1',
|
||||
'schedule' => 'Monday',
|
||||
'capacity' => 30,
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
DB::table('classSection')->insert([
|
||||
[
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 101,
|
||||
'class_section_name' => '1-A',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
],
|
||||
[
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 102,
|
||||
'class_section_name' => '2-B',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
],
|
||||
]);
|
||||
|
||||
$service = app(ClassSectionQueryService::class);
|
||||
$pager = $service->list(['search' => '1-A'], 1, 10);
|
||||
|
||||
$this->assertSame(1, $pager->total());
|
||||
$this->assertSame('1-A', $pager->items()[0]->class_section_name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user