Added failing test

This commit is contained in:
Norbert Orzechowicz 2014-02-15 12:00:54 +01:00
parent 8fef4f0398
commit 462b7af9b1
1 changed files with 14 additions and 0 deletions

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormEvent;
@ -252,4 +253,17 @@ class ResizeFormListenerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array(), $event->getData());
}
public function testOnSubmitDealsWithIteratorAggregate()
{
$this->form->add($this->getForm('1'));
$data = new ArrayCollection(array(0 => 'first', 1 => 'second', 2 => 'third'));
$event = new FormEvent($this->form, $data);
$listener = new ResizeFormListener('text', array(), false, true);
$listener->onSubmit($event);
$this->assertArrayNotHasKey(0, $event->getData());
$this->assertArrayNotHasKey(2, $event->getData());
}
}