public function BackendSavingTests::testObject in Supercache 8
Same name and namespace in other branches
- 2.0.x src/Tests/Generic/Cache/BackendSavingTests.php \Drupal\supercache\Tests\Generic\Cache\BackendSavingTests::testObject()
Test the saving and restoring of an object.
File
- src/
Tests/ Generic/ Cache/ BackendSavingTests.php, line 65
Class
- BackendSavingTests
- Test saving functions.
Namespace
Drupal\supercache\Tests\Generic\CacheCode
public 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',
),
);
$this->backend
->set('test_object', $test_object);
$cache = $this->backend
->get('test_object');
$this
->assertTrue(isset($cache->data) && $cache->data == $test_object, 'Object is saved and restored properly.');
}