$this->
assertTrue($strategy->
isRetryable($envelope));
} /**
* @dataProvider getWaitTimeTests
*/
public function testGetWaitTime(int
$delay, float
$multiplier, int
$maxDelay, int
$previousRetries, int
$expectedDelay) { $strategy =
new MultiplierRetryStrategy(10,
$delay,
$multiplier,
$maxDelay);
$envelope =
new Envelope(new \
stdClass(),
[new RedeliveryStamp($previousRetries)]);
$this->
assertSame($expectedDelay,
$strategy->
getWaitingTime($envelope));
} public static function getWaitTimeTests(): iterable
{ // delay, multiplier, maxDelay, retries, expectedDelay
yield [1000, 1, 5000, 0, 1000
];
yield [1000, 1, 5000, 1, 1000
];
yield [1000, 1, 5000, 2, 1000
];
yield [1000, 2, 10000, 0, 1000
];
yield [1000, 2, 10000, 1, 2000
];