function BackendChainImplementationUnitTest::testGet

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testGet()
  2. 10 core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testGet()
  3. 11.x core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testGet()

Tests the get feature.

File

core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php, line 89

Class

BackendChainImplementationUnitTest
Unit test of backend chain implementation specifics.

Namespace

Drupal\Tests\Core\Cache

Code

public function testGet() {
    $cached = $this->chain
        ->get('t123');
    $this->assertNotFalse($cached, 'Got key that is on all backends');
    $this->assertSame(1231, $cached->data, 'Got the key from the backend 1');
    $cached = $this->chain
        ->get('t23');
    $this->assertNotFalse($cached, 'Got key that is on backends 2 and 3');
    $this->assertSame(232, $cached->data, 'Got the key from the backend 2');
    $cached = $this->chain
        ->get('t3');
    $this->assertNotFalse($cached, 'Got key that is on the backend 3');
    $this->assertSame(33, $cached->data, 'Got the key from the backend 3');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.