1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* Test object cache storage.
|
5
|
*/
|
6
|
class CtoolsObjectCache extends DrupalWebTestCase {
|
7
|
|
8
|
/**
|
9
|
* {@inheritdoc}
|
10
|
*/
|
11
|
public static function getInfo() {
|
12
|
return array(
|
13
|
'name' => 'Object cache storage (UI tests)',
|
14
|
'description' => 'Verify that objects are written, readable and lockable.',
|
15
|
'group' => 'ctools',
|
16
|
'dependencies' => array('ctools'),
|
17
|
);
|
18
|
}
|
19
|
|
20
|
/**
|
21
|
* {@inheritdoc}
|
22
|
*/
|
23
|
public function setUp(array $modules = array()) {
|
24
|
$modules[] = 'ctools';
|
25
|
parent::setUp($modules);
|
26
|
}
|
27
|
|
28
|
|
29
|
public function testObjectStorage() {
|
30
|
ctools_include('cache');
|
31
|
|
32
|
$account1 = $this->drupalCreateUser(array());
|
33
|
$this->drupalLogin($account1);
|
34
|
|
35
|
$data = array(
|
36
|
'test1' => 'foobar',
|
37
|
);
|
38
|
|
39
|
ctools_include('object-cache');
|
40
|
ctools_object_cache_set('testdata', 'one', $data);
|
41
|
$this->assertEqual($data, ctools_object_cache_get('testdata', 'one'), 'Object cache data successfully stored');
|
42
|
|
43
|
// TODO Test object locking somehow.
|
44
|
// Object locking/testing works on session_id but simpletest uses
|
45
|
// $this->session_id so can't be tested ATM.
|
46
|
ctools_object_cache_clear('testdata', 'one');
|
47
|
$this->assertFalse(ctools_object_cache_get('testdata', 'one'), 'Object cache data successfully cleared');
|
48
|
|
49
|
// TODO Test ctools_object_cache_clear_all somehow...
|
50
|
// ctools_object_cache_clear_all requires session_id funtionality as well.
|
51
|
}
|
52
|
|
53
|
}
|