@@ -68,21 +68,21 @@ |
||
| 68 | 68 | $mail3->setDelay(200); |
| 69 | 69 | |
| 70 | 70 | $this->queue->expects('push')->once()->withArgs( |
| 71 | - function ($job, $data, Options $options) { |
|
| 71 | + function ($job, $data, Options $options){ |
|
| 72 | 72 | $this->assertSame(30, $options->getDelay()); |
| 73 | 73 | return true; |
| 74 | 74 | } |
| 75 | 75 | ); |
| 76 | 76 | |
| 77 | 77 | $this->queue->expects('push')->once()->withArgs( |
| 78 | - function ($job, $data, Options $options) { |
|
| 78 | + function ($job, $data, Options $options){ |
|
| 79 | 79 | $this->assertSame(100, $options->getDelay()); |
| 80 | 80 | return true; |
| 81 | 81 | } |
| 82 | 82 | ); |
| 83 | 83 | |
| 84 | 84 | $this->queue->expects('push')->once()->withArgs( |
| 85 | - function ($job, $data, Options $options) { |
|
| 85 | + function ($job, $data, Options $options){ |
|
| 86 | 86 | $this->assertSame(200, $options->getDelay()); |
| 87 | 87 | return true; |
| 88 | 88 | } |
@@ -43,7 +43,8 @@ discard block |
||
| 43 | 43 | $mail->setBCC('[email protected]'); |
| 44 | 44 | |
| 45 | 45 | $this->queue->expects('push')->withArgs( |
| 46 | - function ($job, $data, Options $options) use ($mail) { |
|
| 46 | + function ($job, $data, Options $options) use ($mail) |
|
| 47 | + { |
|
| 47 | 48 | $this->assertSame(MailQueue::JOB_NAME, $job); |
| 48 | 49 | $this->assertSame($data, MessageSerializer::pack($mail)); |
| 49 | 50 | $this->assertSame('mailer', $options->getQueue()); |
@@ -68,21 +69,24 @@ discard block |
||
| 68 | 69 | $mail3->setDelay(200); |
| 69 | 70 | |
| 70 | 71 | $this->queue->expects('push')->once()->withArgs( |
| 71 | - function ($job, $data, Options $options) { |
|
| 72 | + function ($job, $data, Options $options) |
|
| 73 | + { |
|
| 72 | 74 | $this->assertSame(30, $options->getDelay()); |
| 73 | 75 | return true; |
| 74 | 76 | } |
| 75 | 77 | ); |
| 76 | 78 | |
| 77 | 79 | $this->queue->expects('push')->once()->withArgs( |
| 78 | - function ($job, $data, Options $options) { |
|
| 80 | + function ($job, $data, Options $options) |
|
| 81 | + { |
|
| 79 | 82 | $this->assertSame(100, $options->getDelay()); |
| 80 | 83 | return true; |
| 81 | 84 | } |
| 82 | 85 | ); |
| 83 | 86 | |
| 84 | 87 | $this->queue->expects('push')->once()->withArgs( |
| 85 | - function ($job, $data, Options $options) { |
|
| 88 | + function ($job, $data, Options $options) |
|
| 89 | + { |
|
| 86 | 90 | $this->assertSame(200, $options->getDelay()); |
| 87 | 91 | return true; |
| 88 | 92 | } |
@@ -158,11 +158,11 @@ |
||
| 158 | 158 | */ |
| 159 | 159 | public function setDelay($delay): self |
| 160 | 160 | { |
| 161 | - if ($delay instanceof \DateInterval) { |
|
| 161 | + if ($delay instanceof \DateInterval){ |
|
| 162 | 162 | $delay = (new \DateTimeImmutable('NOW'))->add($delay); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if ($delay instanceof \DateTimeInterface) { |
|
| 165 | + if ($delay instanceof \DateTimeInterface){ |
|
| 166 | 166 | $delay = max(0, $delay->getTimestamp() - time()); |
| 167 | 167 | } |
| 168 | 168 | |
@@ -158,11 +158,13 @@ |
||
| 158 | 158 | */ |
| 159 | 159 | public function setDelay($delay): self |
| 160 | 160 | { |
| 161 | - if ($delay instanceof \DateInterval) { |
|
| 161 | + if ($delay instanceof \DateInterval) |
|
| 162 | + { |
|
| 162 | 163 | $delay = (new \DateTimeImmutable('NOW'))->add($delay); |
| 163 | 164 | } |
| 164 | 165 | |
| 165 | - if ($delay instanceof \DateTimeInterface) { |
|
| 166 | + if ($delay instanceof \DateTimeInterface) |
|
| 167 | + { |
|
| 166 | 168 | $delay = max(0, $delay->getTimestamp() - time()); |
| 167 | 169 | } |
| 168 | 170 | |