1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
<?php
namespace Illuminate\Tests\Queue;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Queue;
use Orchestra\Testbench\TestCase;
class QueueDelayTest extends TestCase
{
public function test_queue_delay()
{
Queue::fake();
$job = new TestJob;
dispatch($job);
$this->assertEquals(60, $job->delay);
}
public function test_queue_without_delay()
{
Queue::fake();
$job = new TestJob;
dispatch($job->withoutDelay());
$this->assertEquals(0, $job->delay);
}
public function test_pending_dispatch_without_delay()
{
Queue::fake();
$job = new TestJob;
dispatch($job)->withoutDelay();
$this->assertEquals(0, $job->delay);
}
}
class TestJob implements ShouldQueue
{
use Queueable;
public function __construct()
{
$this->delay(60);
}
}
|