Create tests for app/actions/YearEndProcedures/YearEndCleanup

This commit is contained in:
Matt Young 2025-07-02 22:56:43 -05:00
parent bc12c90049
commit 471fe11570
2 changed files with 21 additions and 6 deletions

View File

@ -6,24 +6,26 @@ use App\Exceptions\AuditionAdminException;
use App\Models\AuditionFlag; use App\Models\AuditionFlag;
use App\Models\AuditLogEntry; use App\Models\AuditLogEntry;
use App\Models\BonusScore; use App\Models\BonusScore;
use App\Models\CalculatedScore; use App\Models\Doubler;
use App\Models\DoublerRequest; use App\Models\DoublerRequest;
use App\Models\EntryFlag; use App\Models\EntryFlag;
use App\Models\EntryTotalScore;
use App\Models\JudgeAdvancementVote; use App\Models\JudgeAdvancementVote;
use App\Models\NominationEnsembleEntry; use App\Models\NominationEnsembleEntry;
use App\Models\ScoreSheet; use App\Models\ScoreSheet;
use App\Models\Seat; use App\Models\Seat;
use App\Models\Student; use App\Models\Student;
use App\Models\UserFlag;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use function auth; use function auth;
/**
* @codeCoverageIgnore
*/
// TODO: figure out how to test YearEndCleanup
class YearEndCleanup class YearEndCleanup
{ {
public function __construct()
{
}
public function __invoke(?array $options = []): void public function __invoke(?array $options = []): void
{ {
$this->cleanup($options); $this->cleanup($options);
@ -49,8 +51,9 @@ class YearEndCleanup
AuditLogEntry::truncate(); AuditLogEntry::truncate();
AuditionFlag::truncate(); AuditionFlag::truncate();
BonusScore::truncate(); BonusScore::truncate();
CalculatedScore::truncate(); EntryTotalScore::truncate();
DoublerRequest::truncate(); DoublerRequest::truncate();
Doubler::truncate();
EntryFlag::truncate(); EntryFlag::truncate();
ScoreSheet::truncate(); ScoreSheet::truncate();
Seat::truncate(); Seat::truncate();
@ -75,6 +78,7 @@ class YearEndCleanup
if (in_array('unassignJudges', $options)) { if (in_array('unassignJudges', $options)) {
DB::table('room_user')->truncate(); DB::table('room_user')->truncate();
UserFlag::where('flag', 'monitor')->delete();
} }
} }

View File

@ -0,0 +1,11 @@
<?php
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
test('', function () {
$response = $this->get('/');
$response->assertStatus(200);
});