/** * {@inheritDoc} */ public function getLabel() { try { return $this->label !== null ? $this->label->getText() : null; } catch (StepLabelCallableInvalidReturnValueException $e) { throw new \RuntimeException(sprintf('The label callable for step %d did not return a string or null value.', $this->number)); } }
protected function createStepWithLabelCallable($number, $returnValue) { return Step::createFromConfig($number, array('label' => StepLabel::createCallableLabel(function () use($returnValue) { return $returnValue; }))); }
/** * @dataProvider dataGetText_callableInvalidReturnValue * @expectedException Craue\FormFlowBundle\Exception\StepLabelCallableInvalidReturnValueException */ public function testGetText_callableInvalidReturnValue($value) { StepLabel::createCallableLabel($value)->getText(); }