Skip to content

Commit 986c42a

Browse files
glioympastegos
authored andcommitted
Allow dynamic tries() method on Queueable listeners (laravel#57014)
1 parent 1e528f3 commit 986c42a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/Events/QueuedEventsTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,24 @@ public function testQueuePropagateRetryUntilAndMaxExceptions()
179179
});
180180
}
181181

182+
public function testQueuePropagateTries()
183+
{
184+
$d = new Dispatcher;
185+
186+
$fakeQueue = new QueueFake(new Container);
187+
188+
$d->setQueueResolver(function () use ($fakeQueue) {
189+
return $fakeQueue;
190+
});
191+
192+
$d->listen('some.event', TestDispatcherOptions::class.'@handle');
193+
$d->dispatch('some.event', ['foo', 'bar']);
194+
195+
$fakeQueue->assertPushed(CallQueuedListener::class, function ($job) {
196+
return $job->tries === 5;
197+
});
198+
}
199+
182200
public function testQueuePropagateMiddleware()
183201
{
184202
$d = new Dispatcher;
@@ -294,6 +312,11 @@ public function retryUntil()
294312
return now()->addHour(1);
295313
}
296314

315+
public function tries()
316+
{
317+
return 5;
318+
}
319+
297320
public function handle()
298321
{
299322
//

0 commit comments

Comments
 (0)