public function doTestPreSetDataForNewEntityWithMultiEnum(AbstractEnumType $type) { $enumValueClassName = 'Test\\EnumValue'; $form = $this->getMock('Symfony\\Component\\Form\\Test\\FormInterface'); $formConfig = $this->expectFormWillReturnFormConfig($form); $this->expectFormConfigWillReturnOptions($formConfig, [['class', null, $enumValueClassName], ['multiple', null, true]]); $parentForm = $this->expectFormWillReturnParentForm($form); $parentFormConfig = $this->expectFormWillReturnFormConfig($parentForm); $this->expectFormConfigWillReturnOptions($parentFormConfig, [['data_class', null, 'TestEntity']]); $data = new TestEntity(); $data->setValue(new ArrayCollection()); $this->expectFormWillReturnData($parentForm, $data); // name of property TestEntity::$value $form->expects($this->once())->method('getPropertyPath')->will($this->returnValue('value')); $event = $this->getFormEventMock2($form); $this->setExpectationsForLoadDefaultEnumValues($enumValueClassName, ['val1', 'val2']); $event->expects($this->once())->method('setData')->with(['val1', 'val2']); $type->preSetData($event); }