-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an issue when the envelope was created with a DelayStamp in the past, the availability was generated in the future.
- Loading branch information
1 parent
d1c4d37
commit b9c3d2d
Showing
2 changed files
with
25 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 |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
use Zenstruck\Messenger\Test\Tests\Fixture\Messenger\MessageA; | ||
use Zenstruck\Messenger\Test\Tests\Fixture\Messenger\MessageB; | ||
use Zenstruck\Messenger\Test\Tests\Fixture\Messenger\MessageC; | ||
use Zenstruck\Messenger\Test\Tests\Fixture\Messenger\MessageD; | ||
|
||
/** | ||
* @author Nicolas PHILIPPE <[email protected]> | ||
|
@@ -88,6 +89,26 @@ public function it_handles_messages_depending_on_delay_stamp(): void | |
$transport->process()->acknowledged()->assertCount(3)->assertContains(MessageA::class); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_handles_directly_messages_with_negative_delay_stamp(): void | ||
{ | ||
$clock = self::mockTime(); | ||
|
||
$transport = $this->transport('async'); | ||
$transport->send(new Envelope(new MessageA(), [new DelayStamp(5_000)])); | ||
$transport->send(new Envelope(new MessageB())); | ||
$transport->send(new Envelope(new MessageC(), [new DelayStamp(-5_000)])); | ||
|
||
$transport->acknowledged()->assertCount(0); | ||
|
||
$transport->process()->acknowledged()->assertCount(2)->assertContains(MessageB::class)->assertContains(MessageC::class); | ||
|
||
$clock->sleep(10); | ||
$transport->process()->acknowledged()->assertCount(3)->assertContains(MessageA::class); | ||
} | ||
|
||
protected static function bootKernel(array $options = []): KernelInterface // @phpstan-ignore-line | ||
{ | ||
return parent::bootKernel(\array_merge(['environment' => 'single_transport'], $options)); | ||
|