yield ['POST', 200,
new TransportException()];
yield ['POST', 500, null
];
} /**
* @dataProvider provideDelay
*/
public function testGetDelay(int
$delay, int
$multiplier, int
$maxDelay, int
$previousRetries, int
$expectedDelay) { $strategy =
new GenericRetryStrategy([],
$delay,
$multiplier,
$maxDelay, 0
);
self::
assertSame($expectedDelay,
$strategy->
getDelay($this->
getContext($previousRetries, 'GET', 'http://example.com/', 200
), null, null
));
} public static function provideDelay(): iterable
{ // delay, multiplier, maxDelay, previousRetries, 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
];