update entryFlagObserver and it's tests to use the DoublerSync action.

This commit is contained in:
Matt Young 2025-07-04 12:06:31 -05:00
parent 0b54b57e41
commit 879403cc33
2 changed files with 10 additions and 5 deletions

View File

@ -2,6 +2,7 @@
namespace App\Observers;
use App\Actions\Tabulation\DoublerSync;
use App\Exceptions\AuditionAdminException;
use App\Models\Doubler;
use App\Models\EntryFlag;
@ -25,10 +26,10 @@ class EntryFlagObserver
public function created(EntryFlag $entryFlag): void
{
Doubler::syncDoublers();
$syncer = app(DoublerSync::class);
$syncer();
Cache::forget('rank_advancement_'.$entryFlag->entry->audition_id);
Cache::forget('rank_seating_'.$entryFlag->entry->audition_id);
}
/**

View File

@ -1,5 +1,6 @@
<?php
use App\Actions\Tabulation\DoublerSync;
use App\Models\Doubler;
use App\Models\Entry;
use Illuminate\Foundation\Testing\RefreshDatabase;
@ -19,11 +20,14 @@ afterEach(function () {
});
it('syncs doublers when a flag is added', function () {
Mockery::mock('overload:App\Models\Doubler')
->shouldReceive('syncDoublers')
$mock = Mockery::mock(DoublerSync::class);
$mock->shouldReceive('__invoke')
->once()
->andReturn(null);
// Bind the mock to the container
app()->instance(DoublerSync::class, $mock);
$this->entry->addFlag('declined');
})->skip();
});
// TODO Figure out how to test