public function BackendChainImplementationUnitTest::testGetMultiple in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testGetMultiple()
Test the get multiple feature.
File
- core/
tests/ Drupal/ Tests/ Core/ Cache/ BackendChainImplementationUnitTest.php, line 107 - Contains \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest.
Class
- BackendChainImplementationUnitTest
- Unit test of backend chain implementation specifics.
Namespace
Drupal\Tests\Core\CacheCode
public function testGetMultiple() {
$cids = array(
't123',
't23',
't3',
't4',
);
$ret = $this->chain
->getMultiple($cids);
$this
->assertSame($ret['t123']->data, 1231, 'Got key 123 and value is from the first backend');
$this
->assertSame($ret['t23']->data, 232, 'Got key 23 and value is from the second backend');
$this
->assertSame($ret['t3']->data, 33, 'Got key 3 and value is from the third backend');
$this
->assertFalse(array_key_exists('t4', $ret), "Didn't get the nonexistent key");
$this
->assertFalse(in_array('t123', $cids), "Existing key 123 has been removed from &\$cids");
$this
->assertFalse(in_array('t23', $cids), "Existing key 23 has been removed from &\$cids");
$this
->assertFalse(in_array('t3', $cids), "Existing key 3 has been removed from &\$cids");
$this
->assertTrue(in_array('t4', $cids), "Non existing key 4 is still in &\$cids");
}