public function BackendChainImplementationUnitTest::testDelete

Test that delete will propagate.

File

drupal/core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php, line 152
Definition of Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest.

Class

BackendChainImplementationUnitTest
Tests implementation-specific functionality of the BackendChain backend.

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