public function CacheTest::testCachedObject in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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
Namespace
Doctrine\Tests\Common\CacheCode
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);
}