fix tests

This commit is contained in:
root
2026-06-11 11:46:12 -04:00
parent c91fa2ce4d
commit 5ead80fdc7
1489 changed files with 11349 additions and 10305 deletions
@@ -7,10 +7,11 @@ use App\Models\ClassProgressReport;
use App\Models\TeacherClass;
use App\Models\User;
use App\Services\SchoolYears\SchoolYearContextService;
use Illuminate\Support\Facades\Schema;
use Carbon\CarbonInterface;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
class ClassProgressMutationService
{
@@ -34,11 +35,11 @@ class ClassProgressMutationService
$weekStart = (string) ($payload['week_start'] ?? '');
$weekEnd = $this->rules->ensureWeekEnd($weekStart, $payload['week_end'] ?? null);
if (!$this->rules->isWeekEndValid($weekStart, $weekEnd)) {
if (! $this->rules->isWeekEndValid($weekStart, $weekEnd)) {
throw new \InvalidArgumentException('Week end must be the same as or after the week start.');
}
if (!$this->rules->hasIslamicUnitSelection($payload)) {
if (! $this->rules->hasIslamicUnitSelection($payload)) {
throw new \InvalidArgumentException('Please select at least one Islamic Studies unit.');
}
@@ -53,7 +54,7 @@ class ClassProgressMutationService
->values()
->all();
if ($existingIds !== [] && !$confirmOverwrite) {
if ($existingIds !== [] && ! $confirmOverwrite) {
throw new \InvalidArgumentException('CONFIRM_OVERWRITE');
}
@@ -150,7 +151,7 @@ class ClassProgressMutationService
throw new \InvalidArgumentException('Please select at least one Islamic Studies unit.');
}
$originalWeekStart = $anchor->week_start instanceof \Carbon\CarbonInterface
$originalWeekStart = $anchor->week_start instanceof CarbonInterface
? $anchor->week_start->format('Y-m-d')
: (string) $anchor->week_start;
@@ -295,7 +296,7 @@ class ClassProgressMutationService
return DB::transaction(function () use ($report, $payload, $attachments) {
$weekStart = $payload['week_start'] ?? $report->week_start?->format('Y-m-d');
$weekEnd = $this->rules->ensureWeekEnd((string) $weekStart, $payload['week_end'] ?? null);
if ($weekStart && $weekEnd && !$this->rules->isWeekEndValid((string) $weekStart, (string) $weekEnd)) {
if ($weekStart && $weekEnd && ! $this->rules->isWeekEndValid((string) $weekStart, (string) $weekEnd)) {
throw new \InvalidArgumentException('Week end must be the same as or after the week start.');
}
@@ -364,7 +365,7 @@ class ClassProgressMutationService
->where('class_section_id', $classSectionId)
->exists();
if (!$assigned) {
if (! $assigned) {
throw new \InvalidArgumentException('No class assignment found for this report.');
}
}