public function assertDefaultBuildViewCalled() { $view = new FormView(); /** @var FormInterface|\PHPUnit_Framework_MockObject_MockObject $form */ $form = $this->getMock('Symfony\\Component\\Form\\FormInterface'); $possibleOptions = [['options' => ['currency' => 'USD'], 'expected' => ['page_component' => null, 'page_component_options' => ['currency' => 'USD']]], ['options' => ['currency' => 'USD', 'page_component' => 'test', 'page_component_options' => ['v2']], 'expected' => ['page_component' => 'test', 'page_component_options' => ['v2', 'currency' => 'USD']]]]; foreach ($possibleOptions as $optionsData) { $this->formType->buildView($view, $form, $optionsData['options']); $this->assertBuildView($view, $optionsData['expected']); } }
/** * {@inheritdoc} */ public function buildView(FormView $view, FormInterface $form, array $options) { parent::buildView($view, $form, $options); /** @var OrderLineItem $item */ $item = $form->getData(); $view->vars['disallow_delete'] = $item && $item->isFromExternalSource(); }