diff --git a/src/StatamicEntryFailedJobProvider.php b/src/FileFailedJobProvider.php similarity index 97% rename from src/StatamicEntryFailedJobProvider.php rename to src/FileFailedJobProvider.php index a6eb58b..b628836 100644 --- a/src/StatamicEntryFailedJobProvider.php +++ b/src/FileFailedJobProvider.php @@ -9,7 +9,7 @@ use Statamic\Facades\YAML; use Statamic\Support\Str; -class StatamicEntryFailedJobProvider implements FailedJobProviderInterface +class FileFailedJobProvider implements FailedJobProviderInterface { /** * Failed Jobs will be saved in this directory. diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index ebfc15f..7f5311e 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -10,14 +10,14 @@ public function boot() { parent::boot(); - $this->bootStatamicFailedJobProvider(); + $this->bootFileFailedJobProvider(); } - private function bootStatamicFailedJobProvider(): self + private function bootFileFailedJobProvider(): self { - if (config('queue.failed.driver') === 'statamic') { + if (config('queue.failed.driver') === 'file') { $this->app->singleton('queue.failer', function ($app) { - return new StatamicEntryFailedJobProvider($app['config']['queue.failed']); + return new FileFailedJobProvider($app['config']['queue.failed']); }); } diff --git a/tests/Unit/StatamicEntryFailedJobProviderTest.php b/tests/Unit/StatamicEntryFailedJobProviderTest.php index 105d013..d45c6d0 100644 --- a/tests/Unit/StatamicEntryFailedJobProviderTest.php +++ b/tests/Unit/StatamicEntryFailedJobProviderTest.php @@ -6,7 +6,7 @@ use Exception; use Illuminate\Support\Carbon; use Illuminate\Support\Str; -use Jonassiewertsen\Jobs\StatamicEntryFailedJobProvider; +use Jonassiewertsen\Jobs\FileFailedJobProvider; use Jonassiewertsen\Jobs\Tests\TestCase; use Statamic\Facades\File; use Statamic\Facades\YAML; @@ -21,7 +21,7 @@ public function a_failed_job_will_be_properly_logged() Carbon::setTestNow(CarbonImmutable::now()); $exception = new Exception('Something went wrong.'); - $provider = new StatamicEntryFailedJobProvider(); + $provider = new FileFailedJobProvider(); $provider->log('connection', 'queue', json_encode(compact('uuid')), $exception); @@ -42,7 +42,7 @@ public function it_can_retrieve_all_failed_jobs() 'failed_at' => now(), ]); - $provider = new StatamicEntryFailedJobProvider(); + $provider = new FileFailedJobProvider(); $this->assertEquals( [[ @@ -61,7 +61,7 @@ public function a_Single_job_can_be_found() 'queue' => 'database', ]); - $provider = new StatamicEntryFailedJobProvider(); + $provider = new FileFailedJobProvider(); $this->assertEquals( $job->id, @@ -72,7 +72,7 @@ public function a_Single_job_can_be_found() /** @test */ public function returns_null_if_the_job_cant_be_found() { - $provider = new StatamicEntryFailedJobProvider(); + $provider = new FileFailedJobProvider(); $this->assertNull($provider->find('not-existing')); } @@ -82,7 +82,7 @@ public function it_can_forget_a_job() { $job = $this->createJobEntry(['id' => 1]); - $provider = new StatamicEntryFailedJobProvider(); + $provider = new FileFailedJobProvider(); $this->assertCount(1, $this->allJobFiles()); @@ -98,7 +98,7 @@ public function it_can_flush_all_jobs() $this->createJobEntry([]); $this->createJobEntry([]); - $provider = new StatamicEntryFailedJobProvider(); + $provider = new FileFailedJobProvider(); $this->assertCount(2, $this->allJobFiles());