ADD SCHOOL YEAR MANAGEMENT
Tests / PHPUnit (push) Failing after 40s

This commit is contained in:
root
2026-07-12 02:21:39 -04:00
parent c7f67da9bf
commit e06ccc9cc0
36 changed files with 6722 additions and 327 deletions
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Services;
use App\Support\SchoolYear\SchoolYearContext;
use RuntimeException;
final class SchoolYearWriteGuard
{
public function assertWritable(
SchoolYearContext $context,
bool $allowDraftForAdmin = false,
bool $isAdmin = false
): void {
if ($context->status() === 'active') {
return;
}
if ($context->status() === 'draft' && $allowDraftForAdmin && $isAdmin) {
return;
}
throw new RuntimeException('The selected school year is read-only.');
}
}