public function testBuildForm() { $builder = $this->getMockBuilder('Symfony\\Component\\Form\\FormBuilder')->disableOriginalConstructor()->getMock(); $builder->expects($this->at(0))->method('add')->with('label', 'text', array('required' => true, 'label' => 'Role')); $builder->expects($this->at(1))->method('add')->with('field', $this->isInstanceOf('Oro\\Bundle\\SecurityBundle\\Form\\Type\\PrivilegeCollectionType'), $this->contains(array('privileges_config' => 'field_config'))); $this->formType->buildForm($builder, array()); }
public function testBuildForm() { $builder = $this->getMockBuilder('Symfony\\Component\\Form\\FormBuilder')->disableOriginalConstructor()->getMock(); $builder->expects($this->at(0))->method('add')->with('label', 'text', array('required' => true, 'label' => 'oro.user.role.role.label')); $builder->expects($this->at(1))->method('add')->with('field', 'oro_acl_collection', $this->contains(array('privileges_config' => 'field_config'))); $this->formType->buildForm($builder, array()); }
/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { foreach ($this->privilegeConfig as $fieldName => $config) { $builder->add($fieldName, 'oro_acl_collection', array('type' => new AclPrivilegeType(), 'allow_add' => true, 'prototype' => false, 'allow_delete' => false, 'mapped' => false, 'options' => array('privileges_config' => $config))); } // Empty the privilege config to prevent parent from overriding the fields $this->privilegeConfig = array(); parent::buildForm($builder, $options); }