You are here

public function CacheCollectorTest::testSetAndGet in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php \Drupal\Tests\Core\Cache\CacheCollectorTest::testSetAndGet()

Tests setting and getting values when the cache is empty.

File

core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php, line 82
Contains \Drupal\Tests\Core\Cache\CacheCollectorTest.

Class

CacheCollectorTest
@coversDefaultClass \Drupal\Core\Cache\CacheCollector @group Cache

Namespace

Drupal\Tests\Core\Cache

Code

public function testSetAndGet() {
  $key = $this
    ->randomMachineName();
  $value = $this
    ->randomMachineName();
  $this
    ->assertNull($this->collector
    ->get($key));
  $this->collector
    ->set($key, $value);
  $this
    ->assertTrue($this->collector
    ->has($key));
  $this
    ->assertEquals($value, $this->collector
    ->get($key));
}