public function testUnSerialize1() { $data1 = array('type' => 'int'); $name1 = 'somename'; $dataType1 = new DataType($name1, null, null, $data1); $serialize1 = $dataType1->serialize(); $dataType2 = DataType::unserialize($serialize1); $this->assertSame($dataType1->data, $dataType2->data); }
/** * Standard constructor * @param $entityName */ public function __construct($entityClass, EntityManager $em) { $this->entity = get_unqualified_class($entityClass); $this->entityClass = $entityClass; $this->entityNamespace = get_namespace($entityClass); $this->entityManager = $em; $this->db = $this->entityManager->db; $this->reflEntityClass = new \ReflectionClass($this->entityClass); // entities might not have the property entityManager accessible try { $this->reflEntityManagerPropertyOfEntity = $this->reflEntityClass->getProperty('entityManager'); $this->reflEntityManagerPropertyOfEntity->setAccessible(true); } catch (\ReflectionException $e) { $this->reflEntityManagerPropertyOfEntity = null; } foreach ($this->dataTypes as &$dataType) { $dataType = DataType::unserialize($dataType); } }