assertTrue(count($cm->getReflectionProperties()) == 0); $this->assertTrue($cm->reflClass instanceof \ReflectionClass); $this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->name); $this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->rootEntityName); $this->assertEquals(array(), $cm->subClasses); $this->assertEquals(array(), $cm->parentClasses); // Customize state $cm->setSubclasses(array("One", "Two", "Three")); $cm->setParentClasses(array("UserParent")); $cm->setCustomRepositoryClass("UserRepository"); $cm->setDiscriminatorColumn(array('name' => 'disc', 'type' => 'integer')); $cm->mapOneToOne(array('fieldName' => 'phonenumbers', 'targetEntity' => 'Bar', 'mappedBy' => 'foo')); $this->assertTrue($cm->getAssociationMapping('phonenumbers') instanceof \Doctrine\ORM\Mapping\OneToOneMapping); $this->assertEquals(1, count($cm->associationMappings)); $serialized = serialize($cm); $cm = unserialize($serialized); // Check state $this->assertTrue(count($cm->getReflectionProperties()) > 0); $this->assertTrue($cm->reflClass instanceof \ReflectionClass); $this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->name); $this->assertEquals('UserParent', $cm->rootEntityName); $this->assertEquals(array('One', 'Two', 'Three'), $cm->subClasses); $this->assertEquals(array('UserParent'), $cm->parentClasses); $this->assertEquals('UserRepository', $cm->getCustomRepositoryClass()); $this->assertEquals(array('name' => 'disc', 'type' => 'integer', 'fieldName' => 'disc'), $cm->discriminatorColumn); $this->assertTrue($cm->getAssociationMapping('phonenumbers') instanceof \Doctrine\ORM\Mapping\OneToOneMapping); $this->assertEquals(1, count($cm->associationMappings)); $oneOneMapping = $cm->getAssociationMapping('phonenumbers'); $this->assertEquals('phonenumbers', $oneOneMapping->getSourceFieldName()); $this->assertEquals('Doctrine\Tests\Models\CMS\Bar', $oneOneMapping->getTargetEntityName()); } }