function MemoryBackendTest::testNotExpiring

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/Flood/MemoryBackendTest.php \Drupal\Tests\Core\Flood\MemoryBackendTest::testNotExpiring()
  2. 11.x core/tests/Drupal/Tests/Core/Flood/MemoryBackendTest.php \Drupal\Tests\Core\Flood\MemoryBackendTest::testNotExpiring()

Tests a flood event with no expiring, so cron will not allow to proceed.

File

core/tests/Drupal/Tests/Core/Flood/MemoryBackendTest.php, line 82

Class

MemoryBackendTest
Tests the memory flood implementation.

Namespace

Drupal\Tests\Core\Flood

Code

public function testNotExpiring() {
    $threshold = 2;
    $this->flood
        ->register('test_event', 1);
    usleep(3);
    $this->flood
        ->register('test_event', 1);
    $this->assertFalse($this->flood
        ->isAllowed('test_event', $threshold));
    // "Run cron", which clears the flood data and verify event is not allowed.
    $this->flood
        ->garbageCollection();
    $this->assertFalse($this->flood
        ->isAllowed('test_event', $threshold));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.