Tests data type preservation.
public function testValueTypeIsKept() {
$backend = $this
->getCacheBackend();
$variables = array(
'test1' => 1,
'test2' => '0',
'test3' => '',
'test4' => 12.64,
'test5' => FALSE,
'test6' => array(
1,
2,
3,
),
);
// Create cache entries.
foreach ($variables as $cid => $data) {
$backend
->set($cid, $data);
}
// Retrieve and test cache objects.
foreach ($variables as $cid => $value) {
$object = $backend
->get($cid);
$this
->assert(is_object($object), sprintf("Backend returned an object for cache id %s.", $cid));
$this
->assertIdentical($value, $object->data, sprintf("Data of cached id %s kept is identical in type and value", $cid));
}
}