object_cache.test in Chaos Tool Suite (ctools) 7
File
tests/object_cache.test
View source
<?php
class CtoolsObjectCache extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Object cache storage (UI tests)',
'description' => 'Verify that objects are written, readable and lockable.',
'group' => 'ctools',
'dependencies' => array(
'ctools',
),
);
}
public function setUp(array $modules = array()) {
$modules[] = 'ctools';
parent::setUp($modules);
}
public function testObjectStorage() {
ctools_include('cache');
$account1 = $this
->drupalCreateUser(array());
$this
->drupalLogin($account1);
$data = array(
'test1' => 'foobar',
);
ctools_include('object-cache');
ctools_object_cache_set('testdata', 'one', $data);
$this
->assertEqual($data, ctools_object_cache_get('testdata', 'one'), 'Object cache data successfully stored');
ctools_object_cache_clear('testdata', 'one');
$this
->assertFalse(ctools_object_cache_get('testdata', 'one'), 'Object cache data successfully cleared');
}
}