Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
romanzipp committed May 12, 2023
1 parent 48c251a commit f7dab2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Controllers/RetryMonitorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace romanzipp\QueueMonitor\Controllers;

use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
Expand All @@ -17,7 +18,7 @@ public function __invoke(Request $request, int $monitorId): RedirectResponse
->where('status', MonitorStatus::FAILED)
->where('retried', false)
->whereNotNull('job_uuid')
->findOrFail($monitorId);
->find($monitorId) ?? throw new ModelNotFoundException();

if (is_a($monitor, Monitor::class)) {
$monitor->retried = true;
Expand Down
3 changes: 3 additions & 0 deletions tests/RoutesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public function testRetryDisabledUi()
/** @var \romanzipp\QueueMonitor\Models\Monitor $monitor */
$monitor = Monitor::query()->create([
'job_id' => mt_rand(),
'job_uuid' => '048f02b7-0dc2-4f9c-9baa-7852273876cc',
]);

$this
Expand All @@ -165,6 +166,7 @@ public function testRetryDisabledRetrying()
/** @var \romanzipp\QueueMonitor\Models\Monitor $monitor */
$monitor = Monitor::query()->create([
'job_id' => mt_rand(),
'job_uuid' => '048f02b7-0dc2-4f9c-9baa-7852273876cc',
]);

$this
Expand All @@ -182,6 +184,7 @@ public function testRetryEnabled()
/** @var \romanzipp\QueueMonitor\Models\Monitor $monitor */
$monitor = Monitor::query()->create([
'job_id' => mt_rand(),
'job_uuid' => '048f02b7-0dc2-4f9c-9baa-7852273876cc',
'status' => MonitorStatus::FAILED,
'retried' => false,
]);
Expand Down

0 comments on commit f7dab2f

Please sign in to comment.