Пример #1
0
 public function testSetDefaultOptions()
 {
     $resolver = $this->getMock('Symfony\\Component\\OptionsResolver\\OptionsResolverInterface');
     $resolver->expects($this->once())->method('setDefaults')->with($this->isType('array'));
     $type = new B2bCustomerType();
     $type->setDefaultOptions($resolver);
 }
Пример #2
0
 public function testFinishView()
 {
     $b2bCustomer = $this->getMockBuilder('OroCRM\\Bundle\\SalesBundle\\Entity\\B2bCustomer')->disableOriginalConstructor()->getMock();
     $b2bCustomer->expects($this->any())->method('getId')->will($this->returnValue(100));
     $b2bCustomer->expects($this->once())->method('getLeads')->will($this->returnValue(new ArrayCollection([])));
     $b2bCustomer->expects($this->once())->method('getOpportunities')->will($this->returnValue(new ArrayCollection([])));
     $form = $this->getMockBuilder('Symfony\\Component\\Form\\Form')->disableOriginalConstructor()->getMock();
     $form->expects($this->once())->method('getData')->will($this->returnValue($b2bCustomer));
     $formView = new FormView();
     $leadsView = new FormView($formView);
     $opportunitiesView = new FormView($formView);
     $formView->children = ['leads' => $leadsView, 'opportunities' => $opportunitiesView];
     $type = new B2bCustomerType($this->router, $this->nameFormatter);
     $type->finishView($formView, $form, []);
     $this->assertArrayHasKey('selection_route', $leadsView->vars);
     $this->assertArrayHasKey('selection_route_parameters', $leadsView->vars);
     $this->assertArrayHasKey('initial_elements', $leadsView->vars);
     $this->assertInternalType('array', $leadsView->vars['initial_elements']);
     $this->assertArrayHasKey('selection_route', $opportunitiesView->vars);
     $this->assertArrayHasKey('selection_route_parameters', $opportunitiesView->vars);
     $this->assertArrayHasKey('initial_elements', $opportunitiesView->vars);
     $this->assertInternalType('array', $opportunitiesView->vars['initial_elements']);
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     $builder->addEventSubscriber(new PatchSubscriber());
 }