/** * @dataProvider getBooleanMatrix1 */ public function testDontDealWithNullOriginalDataIfNotAllowAdd($allowDelete) { $originalData = null; $newData = $this->getData(array(0 => 'first', 1 => 'second', 2 => 'third')); $listener = new MergeCollectionListener(false, $allowDelete); $this->form->setData($originalData); $event = new FilterDataEvent($this->form, $newData); $listener->onBindNormData($event); $this->assertNull($event->getData()); }
/** * @dataProvider getModesWithMergeIntoParent * @expectedException Symfony\Component\Form\Exception\FormException */ public function testThrowExceptionIfInvalidRemover($mode) { $parentData = $this->getMock(__CLASS__ . '_CarCustomNames'); $parentForm = $this->getForm('car'); $parentForm->setData($parentData); $parentForm->add($this->form); $originalData = $this->getData(array(1 => 'second')); $newData = $this->getData(array(0 => 'first')); $listener = new MergeCollectionListener(false, true, $mode, null, 'doesnotexist'); $this->form->setData($originalData); $event = new DataEvent($this->form, $newData); $listener->preBind($event); $event = new FilterDataEvent($this->form, $newData); $listener->onBindNormData($event); }