public function BackendChainImplementationUnitTest::testNotEmptyIfOneBackendHasTheKey

Test that the chain is not empty when at least one backend has data.

File

drupal/core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php, line 209
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 testNotEmptyIfOneBackendHasTheKey() {
  $this
    ->assertFalse($this->chain
    ->isEmpty(), 'Chain is not empty');

  // This is the only test that needs to start with an empty chain.
  $this->chain
    ->deleteAll();
  $this
    ->assertTrue($this->chain
    ->isEmpty(), 'Chain have been emptied by the deleteAll() call');
  $this->secondBackend
    ->set('test', 5);
  $this
    ->assertFalse($this->chain
    ->isEmpty(), 'Chain is not empty anymore now that the second backend has something');
}