add all controllers logic
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\ClassSections;
|
||||
|
||||
use App\Models\ClassSection;
|
||||
use App\Services\ClassSections\ClassSectionCommandService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ClassSectionCommandServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_create_update_delete(): void
|
||||
{
|
||||
$service = app(ClassSectionCommandService::class);
|
||||
|
||||
$section = $service->create([
|
||||
'class_id' => 1,
|
||||
'class_section_id' => 101,
|
||||
'class_section_name' => '1-A',
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
$this->assertInstanceOf(ClassSection::class, $section);
|
||||
$this->assertDatabaseHas('classSection', ['id' => $section->id]);
|
||||
|
||||
$updated = $service->update($section, ['class_section_name' => '1-B']);
|
||||
$this->assertSame('1-B', $updated->class_section_name);
|
||||
|
||||
$deleted = $service->delete($section);
|
||||
$this->assertTrue($deleted);
|
||||
$this->assertDatabaseMissing('classSection', ['id' => $section->id]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user