protected static $modules =
['system'
];
/**
* Tests flood control mechanism clean-up.
*/
public function testCleanUp() { $threshold = 1;
$window_expired = -1;
$name = 'flood_test_cleanup';
$cron =
$this->container->
get('cron'
);
$flood = \Drupal::
flood();
$this->
assertTrue($flood->
isAllowed($name,
$threshold));
// Register expired event.
$flood->
register($name,
$window_expired);
// Verify event is not allowed.
$this->
assertFalse($flood->
isAllowed($name,
$threshold));
// Run cron and verify event is now allowed.
$cron->
run();
$this->
assertTrue($flood->
isAllowed($name,
$threshold));
// Register unexpired event.
$flood->
register($name);