Skip to content

Commit e79e54f

Browse files
dgafkagitbook-bot
authored andcommitted
GITBOOK-878: No subject
1 parent 9a88d48 commit e79e54f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

modelling/testing-support/testing-asynchronous-messaging.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,30 @@ $this->assertEquals(
188188
1. The default behaviour for In Memory Channels is to ignore delays. By setting `second parameter` to `true` we are registering In Memory Channel that will be aware of delays.
189189
2. We are releasing messages that awaits for 60 seconds or less.
190190

191+
### Delaying to given date
192+
193+
If we delay to given point in time, then we can use date time for releasing this message.
194+
195+
```php
196+
$ecotoneTestSupport
197+
->sendCommand(
198+
new SendNotification('123'),
199+
metadata: [
200+
"deliveryDelay" => new \DateTimeImmutable('+1 day')
201+
]
202+
);
203+
204+
$ecotoneTestSupport->run(
205+
'notifications',
206+
releaseAwaitingFor: new \DateTimeImmutable('+1 day')
207+
);
208+
209+
$this->assertEquals(
210+
1,
211+
count($this->notifier->getNotifications())
212+
);
213+
```
214+
191215
## Dropping all messages coming to given channel
192216

193217
In some scenarios, you may just want to turn off given channel, because you're not interested in messages that goes through it.

0 commit comments

Comments
 (0)