public function BackendChainImplementationUnitTest::testDelete

Test that delete will propagate.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Cache/BackendChainImplementationUnitTest.php, line 150
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 testDelete() {
  $this->chain
    ->set('test', 5);
  $cached = $this->firstBackend
    ->get('test');
  $this
    ->assertNotIdentical(FALSE, $cached, 'Test key has been added to the first backend');
  $cached = $this->secondBackend
    ->get('test');
  $this
    ->assertNotIdentical(FALSE, $cached, 'Test key has been added to the first backend');
  $cached = $this->thirdBackend
    ->get('test');
  $this
    ->assertNotIdentical(FALSE, $cached, 'Test key has been added to the first backend');
  $this->chain
    ->delete('test');
  $cached = $this->firstBackend
    ->get('test');
  $this
    ->assertIdentical(FALSE, $cached, 'Test key is removed from the first backend');
  $cached = $this->secondBackend
    ->get('test');
  $this
    ->assertIdentical(FALSE, $cached, 'Test key is removed from the second backend');
  $cached = $this->thirdBackend
    ->get('test');
  $this
    ->assertIdentical(FALSE, $cached, 'Test key is removed from the third backend');
}