$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'
);
} /**
* Tests the get multiple feature.
*/
public function testGetMultiple() { $cids =
['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->
assertArrayNotHasKey('t4',
$ret);
$this->
assertNotContains('t123',
$cids, "Existing key 123 has been removed from &\$cids"
);
$this->
assertNotContains('t23',
$cids, "Existing key 23 has been removed from &\$cids"
);
$this->
assertNotContains('t3',
$cids, "Existing key 3 has been removed from &\$cids"
);
$this->
assertContains('t4',
$cids, "Non existing key 4 is still in &\$cids"
);
}