public function testSerializeUnserializeSerializableObject()
{
$cm = new ClassMetadata("Doctrine\\Tests\\ODM\\CouchDB\\Mapping\\SerializableObject");
$cm->initializeReflection(new RuntimeReflectionService());
$cm->mapField(array('fieldName' => 'property', 'type' => 'integer'));
// @TODO This is the only way the $reflFields property is initialized
// as far as I understand the ClassMetadata code. This seems wrong to
// call here, but otherwise the comparison fails. The $reflFields are
// accesssed all over the code though – I guess there are some bugs
// hidden here.
$cm->wakeupReflection(new RuntimeReflectionService());
// property based comparison
$unserialized = unserialize(serialize($cm));
$unserialized->wakeupReflection(new RuntimeReflectionService());
$this->assertEquals($cm, $unserialized);
}