Skip to content

Commit

Permalink
Rename to File Failed Job Provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Siewertsen committed Jun 28, 2021
1 parent 5512ec7 commit 4d4db10
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
});
}

Expand Down
14 changes: 7 additions & 7 deletions tests/Unit/StatamicEntryFailedJobProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand All @@ -42,7 +42,7 @@ public function it_can_retrieve_all_failed_jobs()
'failed_at' => now(),
]);

$provider = new StatamicEntryFailedJobProvider();
$provider = new FileFailedJobProvider();

$this->assertEquals(
[[
Expand All @@ -61,7 +61,7 @@ public function a_Single_job_can_be_found()
'queue' => 'database',
]);

$provider = new StatamicEntryFailedJobProvider();
$provider = new FileFailedJobProvider();

$this->assertEquals(
$job->id,
Expand All @@ -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'));
}
Expand All @@ -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());

Expand All @@ -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());

Expand Down

0 comments on commit 4d4db10

Please sign in to comment.