You are here

public function BackendChainImplementationUnitTest::testDeleteAllPropagation 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::testDeleteAllPropagation()

Tests that the delete all operation is propagated to all backends in the chain.

File

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

Class

BackendChainImplementationUnitTest
Unit test of backend chain implementation specifics.

Namespace

Drupal\Tests\Core\Cache

Code

public function testDeleteAllPropagation() {

  // Set both expiring and permanent keys.
  $this->chain
    ->set('test1', 1, Cache::PERMANENT);
  $this->chain
    ->set('test2', 3, time() + 1000);
  $this->chain
    ->deleteAll();
  $this
    ->assertFalse($this->firstBackend
    ->get('test1'), 'First key has been deleted in first backend.');
  $this
    ->assertFalse($this->firstBackend
    ->get('test2'), 'Second key has been deleted in first backend.');
  $this
    ->assertFalse($this->secondBackend
    ->get('test1'), 'First key has been deleted in second backend.');
  $this
    ->assertFalse($this->secondBackend
    ->get('test2'), 'Second key has been deleted in second backend.');
  $this
    ->assertFalse($this->thirdBackend
    ->get('test1'), 'First key has been deleted in third backend.');
  $this
    ->assertFalse($this->thirdBackend
    ->get('test2'), 'Second key has been deleted in third backend.');
}