function PerformanceTestTrait::assertCountBetween

Same name in other branches
  1. 10 core/tests/Drupal/Tests/PerformanceTestTrait.php \Drupal\Tests\PerformanceTestTrait::assertCountBetween()

Asserts that a count is between a min and max inclusively.

Parameters

int $min: Minimum value.

int $max: Maximum value.

int $actual: The number to assert against.

string $message: The message to display.

Return value

void

Throws

\PHPUnit\Framework\ExpectationFailedException

2 calls to PerformanceTestTrait::assertCountBetween()
PerformanceTestTrait::assertMetrics in core/tests/Drupal/Tests/PerformanceTestTrait.php
Assert metrics from a performance data value object.
StandardPerformanceTest::testAnonymous in core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
Tests performance for anonymous users.

File

core/tests/Drupal/Tests/PerformanceTestTrait.php, line 618

Class

PerformanceTestTrait
Provides various methods to aid in collecting performance data during tests.

Namespace

Drupal\Tests

Code

protected function assertCountBetween(int $min, int $max, int $actual, string $message = '') {
    if (!empty($message)) {
        $message .= " ";
    }
    static::assertThat($actual, static::logicalAnd(static::greaterThanOrEqual($min), static::lessThanOrEqual($max)), "{$message}{$actual} is greater or equal to {$min} and is smaller or equal to {$max}");
}

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