You are here

public function BackendChainImplementationUnitTest::testDelete in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testDelete()

Tests that delete will propagate.

File

core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php, line 140

Class

BackendChainImplementationUnitTest
Unit test of backend chain implementation specifics.

Namespace

Drupal\Tests\Core\Cache

Code

public function testDelete() {
  $this->chain
    ->set('test', 5);
  $cached = $this->firstBackend
    ->get('test');
  $this
    ->assertNotFalse($cached, 'Test key has been added to the first backend');
  $cached = $this->secondBackend
    ->get('test');
  $this
    ->assertNotFalse($cached, 'Test key has been added to the first backend');
  $cached = $this->thirdBackend
    ->get('test');
  $this
    ->assertNotFalse($cached, 'Test key has been added to the first backend');
  $this->chain
    ->delete('test');
  $cached = $this->firstBackend
    ->get('test');
  $this
    ->assertFalse($cached, 'Test key is removed from the first backend');
  $cached = $this->secondBackend
    ->get('test');
  $this
    ->assertFalse($cached, 'Test key is removed from the second backend');
  $cached = $this->thirdBackend
    ->get('test');
  $this
    ->assertFalse($cached, 'Test key is removed from the third backend');
}