assertValidChildClass() public method

Assert that the given class FQN can be a child of the document this metadata represents.
public assertValidChildClass ( ClassMetadata $class )
$class ClassMetadata
Esempio n. 1
0
 /**
  * It should throw an exception if the given class is not allowed.
  *
  * @expectedException \Doctrine\ODM\PHPCR\Exception\OutOfBoundsException
  * @expectedExceptionMessage does not allow children of type "stdClass"
  */
 public function testAssertValidChildClassesNotAllowed()
 {
     $cm = new ClassMetadata('Doctrine\\Tests\\ODM\\PHPCR\\Mapping\\Person');
     $cm->initializeReflection(new RuntimeReflectionService());
     $childCm = new ClassMetadata('stdClass');
     $childCm->initializeReflection(new RuntimeReflectionService());
     $cm->setChildClasses(array('Doctrine\\Tests\\ODM\\PHPCR\\Mapping\\Person'));
     $cm->assertValidChildClass($childCm);
 }