Skip to content
Browse files

formatting and improved the test to actually check the values

  • Loading branch information...
1 parent a445e03 commit e6600aae97e338f548db9df04f773aa04de33efe @jaapio jaapio committed Dec 12, 2012
View
7 src/DoctrineORMModule/Form/Annotation/ElementAnnotationsListener.php
@@ -1,5 +1,4 @@
<?php
-
namespace DoctrineORMModule\Form\Annotation;
use Doctrine\ORM\Mapping\Column;
@@ -9,6 +8,7 @@
class ElementAnnotationsListener implements ListenerAggregateInterface
{
+
/**
* @var \Zend\Stdlib\CallbackHandler[]
*/
@@ -68,10 +68,9 @@ public function handleAttributesAnnotation($e)
$elementSpec['spec']['attributes']['type'] = 'checkbox';
break;
case 'text':
- $elementSpec['spec']['attributes']['type'] = 'textarea';
+ $elementSpec['spec']['attributes']['type'] = 'textarea';
break;
}
-
}
/**
@@ -170,7 +169,7 @@ public function handleTypeAnnotation($e)
if (!$annotation instanceof Column) {
return;
}
-
+
$type = $annotation->type;
switch ($type) {
case 'bool':
View
5 tests/DoctrineORMModuleTest/Form/ElementAnnotationsListenerTest.php
@@ -35,12 +35,15 @@ public function testHandleAnnotationAttributesShallAppent() {
$annotation->type = 'text';
$event->setParam('annotation', $annotation);
$event->setParam('elementSpec', new ArrayObject(array(
- 'spec' => array('attributes' => array('attr1')),
+ 'spec' => array('attributes' => array('attr1' => 'value')),
)));
$listener->handleAttributesAnnotation($event);
$spec = $event->getParam('elementSpec');
$this->assertCount(2 , $spec['spec']['attributes']);
+ $this->assertArrayHasKey('attr1', $spec['spec']['attributes']);
+ $this->assertEquals('textarea', $spec['spec']['attributes']['type']);
+ $this->assertEquals('value', $spec['spec']['attributes']['attr1']);
}
public function eventProvider() {

0 comments on commit e6600aa

Please sign in to comment.
Something went wrong with that request. Please try again.