You are here

public function CacheCollectorTest::testSetAndGet in Drupal 8

Tests setting and getting values when the cache is empty.

File

core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php, line 76

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));
}