Projet

Général

Profil

Paste
Télécharger (1,4 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ctools / tests / object_cache.test @ 7e72b748

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
  function setUp(array $modules = array()) {
24
    $modules[] = 'ctools';
25
    parent::setUp($modules);
26
  }
27

    
28
  /**
29
   *
30
   */
31
  public function testObjectStorage() {
32
    ctools_include('cache');
33

    
34
    $account1 = $this->drupalCreateUser(array());
35
    $this->drupalLogin($account1);
36

    
37
    $data = array(
38
      'test1' => 'foobar',
39
    );
40

    
41
    ctools_include('object-cache');
42
    ctools_object_cache_set('testdata', 'one', $data);
43
    $this->assertEqual($data, ctools_object_cache_get('testdata', 'one'), 'Object cache data successfully stored');
44

    
45
    // TODO Test object locking somehow.
46
    // Object locking/testing works on session_id but simpletest uses
47
    // $this->session_id so can't be tested ATM.
48

    
49
    ctools_object_cache_clear('testdata', 'one');
50
    $this->assertFalse(ctools_object_cache_get('testdata', 'one'), 'Object cache data successfully cleared');
51

    
52
    // TODO Test ctools_object_cache_clear_all somehow...
53
    // ctools_object_cache_clear_all requires session_id funtionality as well.
54
  }
55
}