add controllers, servoices

This commit is contained in:
root
2026-03-09 02:52:13 -04:00
parent c8de5f7edc
commit d76c871cb7
501 changed files with 34439 additions and 21843 deletions
@@ -0,0 +1,69 @@
<?php
namespace Tests\Unit\Services\Grading;
use App\Services\Grading\GradingLockService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;
class GradingLockServiceTest extends TestCase
{
use RefreshDatabase;
public function test_toggle_creates_lock(): void
{
DB::table('classSection')->insert([
'id' => 1,
'class_section_id' => 1,
'class_section_name' => '1A',
'class_id' => 1,
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
$service = new GradingLockService();
$locked = $service->toggle(1, 'Fall', '2025-2026', 99);
$this->assertTrue($locked);
$this->assertDatabaseHas('grading_locks', [
'class_section_id' => 1,
'semester' => 'Fall',
'school_year' => '2025-2026',
'is_locked' => 1,
]);
}
public function test_lock_all_locks_sections(): void
{
DB::table('classSection')->insert([
[
'id' => 1,
'class_section_id' => 1,
'class_section_name' => '1A',
'class_id' => 1,
'semester' => 'Fall',
'school_year' => '2025-2026',
],
[
'id' => 2,
'class_section_id' => 2,
'class_section_name' => '1B',
'class_id' => 1,
'semester' => 'Fall',
'school_year' => '2025-2026',
],
]);
$service = new GradingLockService();
$count = $service->lockAll('Fall', '2025-2026', 99);
$this->assertSame(2, $count);
$this->assertDatabaseHas('grading_locks', [
'class_section_id' => 2,
'semester' => 'Fall',
'school_year' => '2025-2026',
'is_locked' => 1,
]);
}
}