object_cache.test

  1. nittany7 modules/contrib/ctools/tests/object_cache.test
  2. cis7 modules/contrib/ctools/tests/object_cache.test
  3. mooc7 modules/contrib/ctools/tests/object_cache.test

Tests for different parts of the ctools object caching system.

Classes

Namesort descending Description
CtoolsObjectCache Test object cache storage.

File

modules/contrib/ctools/tests/object_cache.test
View source
  1. <?php
  2. /**
  3. * @file
  4. * Tests for different parts of the ctools object caching system.
  5. */
  6. /**
  7. * Test object cache storage.
  8. */
  9. class CtoolsObjectCache extends DrupalWebTestCase {
  10. public static function getInfo() {
  11. return array(
  12. 'name' => 'Ctools object cache storage',
  13. 'description' => 'Verify that objects are written, readable and lockable.',
  14. 'group' => 'Chaos Tools Suite',
  15. );
  16. }
  17. public function setUp() {
  18. // Additionally enable ctools module.
  19. parent::setUp('ctools');
  20. }
  21. public function testObjectStorage() {
  22. $account1 = $this->drupalCreateUser(array());
  23. $this->drupalLogin($account1);
  24. $data = array(
  25. 'test1' => 'foobar',
  26. );
  27. ctools_include('object-cache');
  28. ctools_object_cache_set('testdata', 'one', $data);
  29. $this->assertEqual($data, ctools_object_cache_get('testdata', 'one'), 'Object cache data successfully stored');
  30. // TODO Test object locking somehow.
  31. // Object locking/testing works on session_id but simpletest uses
  32. // $this->session_id so can't be tested ATM.
  33. ctools_object_cache_clear('testdata', 'one');
  34. $this->assertFalse(ctools_object_cache_get('testdata', 'one'), 'Object cache data successfully cleared');
  35. // TODO Test ctools_object_cache_clear_all somehow...
  36. // ctools_object_cache_clear_all requires session_id funtionality as well.
  37. }
  38. }