function BackendChainImplementationUnitTest::testGetMultipleHasPropagated

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

Ensure get multiple values propagation to previous backends.

File

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

Class

BackendChainImplementationUnitTest
Unit test of backend chain implementation specifics.

Namespace

Drupal\Tests\Core\Cache

Code

public function testGetMultipleHasPropagated() {
    $cids = [
        't3',
        't23',
    ];
    $this->chain
        ->getMultiple($cids);
    $cached = $this->firstBackend
        ->get('t3');
    $this->assertNotSame(FALSE, $cached, 'Test 3 has been propagated to the first backend');
    $this->assertSame(33, $cached->data, 'And value has been kept');
    $cached = $this->secondBackend
        ->get('t3');
    $this->assertNotSame(FALSE, $cached, 'Test 3 has been propagated to the second backend');
    $this->assertSame(33, $cached->data, 'And value has been kept');
    $cached = $this->firstBackend
        ->get('t23');
    $this->assertNotSame(FALSE, $cached, 'Test 2 has been propagated to the first backend');
    $this->assertSame(232, $cached->data, 'And value has been kept');
}

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