-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
03776d2
commit ecbd996
Showing
2 changed files
with
60 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,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ChessZebra\JobSystem\Storage\InMemory; | ||
|
||
use ChessZebra\JobSystem\Job\Job; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class DelayedJobTest extends TestCase | ||
{ | ||
/** | ||
* Tests if the isReady method returns true when the job is actually ready. | ||
* | ||
* @covers \ChessZebra\JobSystem\Storage\InMemory\DelayedJob::__construct | ||
* @covers \ChessZebra\JobSystem\Storage\InMemory\DelayedJob::isReady | ||
*/ | ||
public function testReadyToRumble(): void | ||
{ | ||
// Arrange | ||
$job = new Job('', []); | ||
$storedJob = new StoredJob($job, 1); | ||
$delayedJob = new DelayedJob($storedJob, null, null); | ||
|
||
// Act | ||
$result = $delayedJob->isReady(); | ||
|
||
// Assert | ||
static::assertTrue($result); | ||
} | ||
/** | ||
* Tests if the isReady method returns falsse when the job is no ready yet. | ||
* | ||
* @covers \ChessZebra\JobSystem\Storage\InMemory\DelayedJob::__construct | ||
* @covers \ChessZebra\JobSystem\Storage\InMemory\DelayedJob::isReady | ||
*/ | ||
public function testWaitForReady(): void | ||
{ | ||
// Arrange | ||
$job = new Job('', []); | ||
$storedJob = new StoredJob($job, 1); | ||
$delayedJob = new DelayedJob($storedJob, 1, null); | ||
|
||
// Act | ||
$result = $delayedJob->isReady(); | ||
|
||
// Assert | ||
static::assertFalse($result); | ||
} | ||
} |