function BackendChainImplementationUnitTest::testDelete

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

Test 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->assertNotSame(FALSE, $cached, 'Test key has been added to the first backend');
    $cached = $this->secondBackend
        ->get('test');
    $this->assertNotSame(FALSE, $cached, 'Test key has been added to the first backend');
    $cached = $this->thirdBackend
        ->get('test');
    $this->assertNotSame(FALSE, $cached, 'Test key has been added to the first backend');
    $this->chain
        ->delete('test');
    $cached = $this->firstBackend
        ->get('test');
    $this->assertSame(FALSE, $cached, 'Test key is removed from the first backend');
    $cached = $this->secondBackend
        ->get('test');
    $this->assertSame(FALSE, $cached, 'Test key is removed from the second backend');
    $cached = $this->thirdBackend
        ->get('test');
    $this->assertSame(FALSE, $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.