use Symfony\Bridge\PhpUnit\ClockMock;
use Symfony\Component\RateLimiter\Exception\RateLimitExceededException;
use Symfony\Component\RateLimiter\RateLimit;
/**
* @group time-sensitive
*/
class RateLimitTest extends TestCase
{ public function testEnsureAcceptedDoesNotThrowExceptionIfAccepted() { $rateLimit =
new RateLimit(10,
new \
DateTimeImmutable(), true, 10
);
$this->
assertSame($rateLimit,
$rateLimit->
ensureAccepted());
} public function testEnsureAcceptedThrowsRateLimitExceptionIfNotAccepted() { $rateLimit =
new RateLimit(10,
$retryAfter =
new \
DateTimeImmutable(), false, 10
);
try { $rateLimit->
ensureAccepted();
} catch (RateLimitExceededException
$exception) {