public function BackendChainImplementationUnitTest::testDeleteAllPropagation

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

File

drupal/core/modules/system/lib/Drupal/system/Tests/Cache/BackendChainImplementationUnitTest.php, line 221
Definition of Drupal\system\Tests\Cache\BackendChainImplementationUnitTest.

Class

BackendChainImplementationUnitTest
Tests implementation-specific functionality of the BackendChain backend.

Namespace

Drupal\system\Tests\Cache

Code

public function testDeleteAllPropagation() {

  // Set both expiring and permanent keys.
  $this->chain
    ->set('test1', 1, CacheBackendInterface::CACHE_PERMANENT);
  $this->chain
    ->set('test2', 3, time() + 1000);
  $this->chain
    ->deleteAll();
  $this
    ->assertTrue($this->firstBackend
    ->isEmpty(), 'First backend is empty after delete all.');
  $this
    ->assertTrue($this->secondBackend
    ->isEmpty(), 'Second backend is empty after delete all.');
  $this
    ->assertTrue($this->thirdBackend
    ->isEmpty(), 'Third backend is empty after delete all.');
}