/** * @param array $options * @param string $expectedUrl * @dataProvider optionsDataProvider */ public function testExecute(array $options, $expectedUrl) { if (!empty($options['route'])) { } $context = new ItemStub(); $this->action->initialize($options); $this->action->execute($context); $urlProperty = self::REDIRECT_PATH; $this->assertEquals($expectedUrl, $context->{$urlProperty}); }
/** * Allowed options: * - workflow_item|0 - attribute that contains WorklfowItem to perform redirect * * {@inheritDoc} */ public function initialize(array $options) { if (empty($options['workflow_item']) && empty($options[0])) { throw new InvalidParameterException('Workflow item parameter is required'); } if (!empty($options['workflow_item'])) { $workflowItemProperty = $options['workflow_item']; unset($options['workflow_item']); } else { $workflowItemProperty = $options[0]; unset($options[0]); } if (!$workflowItemProperty instanceof PropertyPath) { throw new InvalidParameterException('Workflow item must be valid property definition'); } // route parameters to generate URL that leads to workflow item edit page $options['route'] = 'oro_workflow_step_edit'; $options['route_parameters'] = array('id' => new PropertyPath((string) $workflowItemProperty . '.id')); $this->redirectAction->initialize($options); return $this; }