1 cache.test CacheSavingCase::testObject()

Test the saving and restoring of an object.

File

core/modules/simpletest/tests/cache.test, line 124

Class

CacheSavingCase

Code

function testObject() {
  $test_object = new stdClass();
  $test_object->test1 = $this->randomName(100);
  $test_object->test2 = 100;
  $test_object->test3 = array('backdrop1', 'backdrop2' => 'backdrop3', 'backdrop4' => array('backdrop5', 'backdrop6'));


  cache()->set('test_object', $test_object);
  $cached = cache()->get('test_object');
  $this->assertTrue(isset($cached->data) && $cached->data == $test_object, 'Object is saved and restored properly.');
}