public function CacheCollectorTest::testDelete in Drupal 8
Tests setting and deleting values.
File
- core/
tests/ Drupal/ Tests/ Core/ Cache/ CacheCollectorTest.php, line 131
Class
- CacheCollectorTest
- @coversDefaultClass \Drupal\Core\Cache\CacheCollector @group Cache
Namespace
Drupal\Tests\Core\CacheCode
public function testDelete() {
$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));
$this->cacheBackend
->expects($this
->once())
->method('invalidate')
->with($this->cid);
$this->collector
->delete($key);
$this
->assertFalse($this->collector
->has($key));
$this
->assertEquals(NULL, $this->collector
->get($key));
}