You are here

function MemCacheSavingCase::testObject in Zircon Profile 8.0

Same name in this branch
  1. 8.0 modules/memcache/tests/memcache.test \MemCacheSavingCase::testObject()
  2. 8.0 modules/memcache/tests/memcache6.test \MemCacheSavingCase::testObject()
Same name and namespace in other branches
  1. 8 modules/memcache/tests/memcache.test \MemCacheSavingCase::testObject()
  2. 8 modules/memcache/tests/memcache6.test \MemCacheSavingCase::testObject()

Test the saving and restoring of an object.

File

modules/memcache/tests/memcache.test, line 150

Class

MemCacheSavingCase

Code

function testObject() {
  $test_object = new stdClass();
  $test_object->test1 = $this
    ->randomName(100);
  $test_object->test2 = 100;
  $test_object->test3 = array(
    'drupal1',
    'drupal2' => 'drupal3',
    'drupal4' => array(
      'drupal5',
      'drupal6',
    ),
  );
  cache_set('test_object', $test_object, 'cache');
  $cache = cache_get('test_object', 'cache');
  $this
    ->assertTrue(isset($cache->data) && $cache->data == $test_object, t('Object is saved and restored properly.'));
}