use Symfony\Component\RateLimiter\Policy\TokenBucketLimiter;
use Symfony\Component\RateLimiter\RateLimiterFactory;
use Symfony\Component\RateLimiter\Storage\InMemoryStorage;
class RateLimiterFactoryTest extends TestCase
{ /**
* @dataProvider validConfigProvider
*/
public function testValidConfig(string
$expectedClass, array
$config) { $factory =
new RateLimiterFactory($config,
new InMemoryStorage());
$rateLimiter =
$factory->
create('key'
);
$this->
assertInstanceOf($expectedClass,
$rateLimiter);
} public static function validConfigProvider() { yield [TokenBucketLimiter::
class,
[ 'policy' => 'token_bucket',
'id' => 'test',
'limit' => 5,
'rate' =>
[