public function BackendChainImplementationUnitTest::testGet

Test the get feature.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Cache/BackendChainImplementationUnitTest.php, line 96
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 testGet() {
  $cached = $this->chain
    ->get('t123');
  $this
    ->assertNotIdentical(FALSE, $cached, 'Got key that is on all backends');
  $this
    ->assertIdentical(1231, $cached->data, 'Got the key from the backend 1');
  $cached = $this->chain
    ->get('t23');
  $this
    ->assertNotIdentical(FALSE, $cached, 'Got key that is on backends 2 and 3');
  $this
    ->assertIdentical(232, $cached->data, 'Got the key from the backend 2');
  $cached = $this->chain
    ->get('t3');
  $this
    ->assertNotIdentical(FALSE, $cached, 'Got key that is on the backend 3');
  $this
    ->assertIdentical(33, $cached->data, 'Got the key from the backend 3');
}