-
Notifications
You must be signed in to change notification settings - Fork 635
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #478 from driesvints/fix-find-failed
[2.0] Fix findFailed method
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Laravel\Horizon\Tests\Feature; | ||
|
||
use Exception; | ||
use Laravel\Horizon\JobPayload; | ||
use Laravel\Horizon\Tests\IntegrationTest; | ||
use Laravel\Horizon\Contracts\JobRepository; | ||
|
||
class RedisJobRepositoryTest extends IntegrationTest | ||
{ | ||
public function test_it_can_find_a_failed_job_by_its_id() | ||
{ | ||
$repository = $this->app->make(JobRepository::class); | ||
$payload = new JobPayload(json_encode(['id' => 1, 'displayName' => 'foo'])); | ||
|
||
$repository->failed(new Exception('Failed Job'), 'redis', 'default', $payload); | ||
|
||
$this->assertEquals(1, $repository->findFailed(1)->id); | ||
} | ||
|
||
public function test_it_will_not_find_a_failed_job_if_the_job_has_not_failed() | ||
{ | ||
$repository = $this->app->make(JobRepository::class); | ||
$payload = new JobPayload(json_encode(['id' => 1, 'displayName' => 'foo'])); | ||
|
||
$repository->pushed('redis', 'default', $payload); | ||
|
||
$this->assertNull($repository->findFailed(1)); | ||
} | ||
} |