update entryFlagObserver and it's tests to use the DoublerSync action.
This commit is contained in:
parent
0b54b57e41
commit
879403cc33
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Observers;
|
namespace App\Observers;
|
||||||
|
|
||||||
|
use App\Actions\Tabulation\DoublerSync;
|
||||||
use App\Exceptions\AuditionAdminException;
|
use App\Exceptions\AuditionAdminException;
|
||||||
use App\Models\Doubler;
|
use App\Models\Doubler;
|
||||||
use App\Models\EntryFlag;
|
use App\Models\EntryFlag;
|
||||||
|
|
@ -25,10 +26,10 @@ class EntryFlagObserver
|
||||||
|
|
||||||
public function created(EntryFlag $entryFlag): void
|
public function created(EntryFlag $entryFlag): void
|
||||||
{
|
{
|
||||||
Doubler::syncDoublers();
|
$syncer = app(DoublerSync::class);
|
||||||
|
$syncer();
|
||||||
Cache::forget('rank_advancement_'.$entryFlag->entry->audition_id);
|
Cache::forget('rank_advancement_'.$entryFlag->entry->audition_id);
|
||||||
Cache::forget('rank_seating_'.$entryFlag->entry->audition_id);
|
Cache::forget('rank_seating_'.$entryFlag->entry->audition_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Actions\Tabulation\DoublerSync;
|
||||||
use App\Models\Doubler;
|
use App\Models\Doubler;
|
||||||
use App\Models\Entry;
|
use App\Models\Entry;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
|
@ -19,11 +20,14 @@ afterEach(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('syncs doublers when a flag is added', function () {
|
it('syncs doublers when a flag is added', function () {
|
||||||
Mockery::mock('overload:App\Models\Doubler')
|
$mock = Mockery::mock(DoublerSync::class);
|
||||||
->shouldReceive('syncDoublers')
|
$mock->shouldReceive('__invoke')
|
||||||
->once()
|
->once()
|
||||||
->andReturn(null);
|
->andReturn(null);
|
||||||
|
|
||||||
|
// Bind the mock to the container
|
||||||
|
app()->instance(DoublerSync::class, $mock);
|
||||||
|
|
||||||
$this->entry->addFlag('declined');
|
$this->entry->addFlag('declined');
|
||||||
})->skip();
|
});
|
||||||
// TODO Figure out how to test
|
// TODO Figure out how to test
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue