-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [11.x] Add `withoutDelay()` to the `Queueable` trait * Update Queueable.php --------- Co-authored-by: Taylor Otwell <[email protected]>
- Loading branch information
1 parent
022ebc9
commit f6f5a95
Showing
2 changed files
with
55 additions
and
0 deletions.
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,43 @@ | ||
<?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); | ||
} | ||
} | ||
|
||
class TestJob implements ShouldQueue | ||
{ | ||
use Queueable; | ||
|
||
public function __construct() | ||
{ | ||
$this->delay(60); | ||
} | ||
} |