function CacheTestBase::assertCacheExists

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Cache/CacheTestBase.php \Drupal\Tests\system\Functional\Cache\CacheTestBase::assertCacheExists()
  2. 8.9.x core/modules/system/src/Tests/Cache/CacheTestBase.php \Drupal\system\Tests\Cache\CacheTestBase::assertCacheExists()
  3. 8.9.x core/modules/system/tests/src/Functional/Cache/CacheTestBase.php \Drupal\Tests\system\Functional\Cache\CacheTestBase::assertCacheExists()
  4. 11.x core/modules/system/tests/src/Functional/Cache/CacheTestBase.php \Drupal\Tests\system\Functional\Cache\CacheTestBase::assertCacheExists()

Asserts that a cache entry exists.

Parameters

$message: Message to display.

$var: The variable the cache should contain.

$cid: The cache id.

$bin: The bin the cache item was stored in.

File

core/modules/system/tests/src/Functional/Cache/CacheTestBase.php, line 53

Class

CacheTestBase
Provides helper methods for cache tests.

Namespace

Drupal\Tests\system\Functional\Cache

Code

protected function assertCacheExists($message, $var = NULL, $cid = NULL, $bin = NULL) {
    if ($bin == NULL) {
        $bin = $this->defaultBin;
    }
    if ($cid == NULL) {
        $cid = $this->defaultCid;
    }
    if ($var == NULL) {
        $var = $this->defaultValue;
    }
    $this->assertTrue($this->checkCacheExists($cid, $var, $bin), $message);
}

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