Optimize academy
This commit is contained in:
35
tests/Unit/Jobs/RecComputeSimilarHybridJobTest.php
Normal file
35
tests/Unit/Jobs/RecComputeSimilarHybridJobTest.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Jobs;
|
||||
|
||||
use App\Jobs\RecComputeSimilarHybridJob;
|
||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||
use Tests\TestCase;
|
||||
|
||||
final class RecComputeSimilarHybridJobTest extends TestCase
|
||||
{
|
||||
public function test_job_uses_single_attempt_to_avoid_retry_loop_failures(): void
|
||||
{
|
||||
$job = new RecComputeSimilarHybridJob(123);
|
||||
|
||||
$this->assertSame(1, $job->tries);
|
||||
}
|
||||
|
||||
public function test_artwork_specific_jobs_use_without_overlapping_middleware(): void
|
||||
{
|
||||
$job = new RecComputeSimilarHybridJob(123);
|
||||
$middleware = $job->middleware();
|
||||
|
||||
$this->assertCount(1, $middleware);
|
||||
$this->assertInstanceOf(WithoutOverlapping::class, $middleware[0]);
|
||||
}
|
||||
|
||||
public function test_batch_jobs_do_not_use_without_overlapping_middleware(): void
|
||||
{
|
||||
$job = new RecComputeSimilarHybridJob(null, 200);
|
||||
|
||||
$this->assertSame([], $job->middleware());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user