You are here

public function CacheTest::testCachedObject in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php \Doctrine\Tests\Common\Cache\CacheTest::testCachedObject()

Check to see that objects are correctly serialized and unserialized by the cache provider.

1 method overrides CacheTest::testCachedObject()
PhpFileCacheTest::testCachedObject in vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php
Check to see that objects are correctly serialized and unserialized by the cache provider.

File

vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php, line 315

Class

CacheTest

Namespace

Doctrine\Tests\Common\Cache

Code

public function testCachedObject() {
  $cache = $this
    ->_getCacheDriver();
  $cache
    ->deleteAll();
  $obj = new \stdClass();
  $obj->foo = "bar";
  $obj2 = new \stdClass();
  $obj2->bar = "foo";
  $obj2->obj = $obj;
  $obj->obj2 = $obj2;
  $cache
    ->save("obj", $obj);
  $fetched = $cache
    ->fetch("obj");
  $this
    ->assertInstanceOf("stdClass", $obj);
  $this
    ->assertInstanceOf("stdClass", $obj->obj2);
  $this
    ->assertInstanceOf("stdClass", $obj->obj2->obj);
  $this
    ->assertEquals("bar", $fetched->foo);
  $this
    ->assertEquals("foo", $fetched->obj2->bar);
}