public function testExecuteInitAction() { $workflowItem = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Entity\\WorkflowItem')->disableOriginalConstructor()->getMock(); $action = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Model\\Action\\ActionInterface')->getMock(); $action->expects($this->once())->method('execute')->with($workflowItem); $this->listener->initialize($workflowItem, $action); $this->listener->executeInitAction(); }
/** * Adds required event listeners * * @param FormBuilderInterface $builder * @param array $options */ protected function addEventListeners(FormBuilderInterface $builder, array $options) { if (!empty($options['attribute_default_values'])) { $this->defaultValuesListener->initialize($options['workflow_item'], $options['attribute_default_values']); $builder->addEventSubscriber($this->defaultValuesListener); } if (!empty($options['init_actions'])) { $this->initActionsListener->initialize($options['workflow_item'], $options['init_actions']); $builder->addEventSubscriber($this->initActionsListener); } if (!empty($options['attribute_fields'])) { $this->requiredAttributesListener->initialize(array_keys($options['attribute_fields'])); $builder->addEventSubscriber($this->requiredAttributesListener); } }