/** * Ensure user defined \Type or type attribute overrides the listener one */ public function testEnsureCustomTypeOrAttributeTypeIsUsedInAnnotations() { $userDefinedTypeOverridesListenerType = true; $entity = new FormEntity(); $zendAnnotationBuilder = new ZendAnnotationBuilder(); $zendForm = $zendAnnotationBuilder->createForm($entity); $spec = $this->builder->getFormSpecification($entity); $annotationForm = $this->builder->createForm($entity); $attributesToTest = array('specificType', 'specificMultiType', 'specificAttributeType'); foreach ($spec['elements'] as $element) { $elementName = $element['spec']['name']; if (in_array($elementName, $attributesToTest)) { $annotationFormElement = $annotationForm->get($elementName); $zendFormElement = $zendForm->get($elementName); $annotationElementAttribute = $annotationFormElement->getAttribute('type'); $zendElementAttribute = $zendFormElement->getAttribute('type'); if (get_class($zendFormElement) !== get_class($annotationFormElement) || $annotationElementAttribute !== $zendElementAttribute) { $userDefinedTypeOverridesListenerType = false; } } } $this->assertTrue($userDefinedTypeOverridesListenerType); }
/** * @covers \DoctrineORMModule\Form\Annotation\AnnotationBuilder::getFormSpecification */ public function testAnnotationBuilderSupportsClassNames() { $spec = $this->builder->getFormSpecification('DoctrineORMModuleTest\\Assets\\Entity\\Issue237'); $this->assertCount(0, $spec['elements'], 'Annotation builder allows also class names'); }