function BackendChainImplementationUnitTest::testDeleteAllPropagation

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testDeleteAllPropagation()
  2. 10 core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testDeleteAllPropagation()
  3. 11.x core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testDeleteAllPropagation()

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

File

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.