public function BackendChainImplementationUnitTest::testNotEmptyIfOneBackendHasTheKey

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

File

drupal/core/modules/system/lib/Drupal/system/Tests/Cache/BackendChainImplementationUnitTest.php, line 207
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 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
    ->assert($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');
}