You are here

public function DailyTagPurgeLimitCheckTest::testDailyTagPurgeLimitCheck in CloudFlare 8

Tests that DailyTagPurgeLimitCheck responds as expected.

@dataProvider dailyTagPurgeLimitCheckProvider

Parameters

int $api_rate: The currentAPI rate to test.

int $expected_severity: The expected diagnostic severity.

File

modules/cloudflarepurger/tests/src/Unit/DailyTagPurgeLimitCheckTest.php, line 38

Class

DailyTagPurgeLimitCheckTest
Tests that purge_requirements() passes on our diagnostic checks.

Namespace

Drupal\Tests\cloudflarepurger\Unit

Code

public function testDailyTagPurgeLimitCheck($api_rate, $expected_severity) {
  $this->drupalState
    ->set(State::TAG_PURGE_DAILY_COUNT, $api_rate);
  $this->drupalState
    ->set(State::TAG_PURGE_DAILY_COUNT_START, new \DateTime());
  $api_rate_limit_check = new DailyTagPurgeLimitCheck([], '23123', 'this is a definition', $this->cloudflareState, $this->composerDependencyStub);
  $actual_severity = $api_rate_limit_check
    ->run();
  $this
    ->assertEquals($expected_severity, $actual_severity);
}