function BackendChainImplementationUnitTest::testDelete

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testDelete()
  2. 8.9.x core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testDelete()
  3. 10 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 147

Class

BackendChainImplementationUnitTest
Unit test of backend chain implementation specifics.

Namespace

Drupal\Tests\Core\Cache

Code

public function testDelete() : void {
    $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');
}

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