示例#1
0
 /**
  * {@inheritdoc}
  */
 public function interpret(Step $step, array $arguments)
 {
     $callable = array_shift($arguments);
     if (!is_callable($callable)) {
         throw new StepInterpretationException('Step of id [' . $step->getIdentifier() . '] does not contain callable');
     }
     return call_user_func_array($callable, $arguments);
 }
示例#2
0
 function let(ArgumentResolver $argumentResolver, InterpreterInterface $interpreter, Procedure $procedure, Step $stepA, Step $stepB, Step $stepC)
 {
     $this->argumentResolver = $argumentResolver;
     $this->interpreter = $interpreter;
     $this->procedure = $procedure;
     $this->stepA = $stepA;
     $this->stepB = $stepB;
     $this->stepC = $stepC;
     $stepA->getIdentifier()->willReturn(self::STEP_NAME_A);
     $stepB->getIdentifier()->willReturn(self::STEP_NAME_B);
     $stepC->getIdentifier()->willReturn(self::STEP_NAME_C);
     $stepA->getArguments()->willReturn(array());
     $stepB->getArguments()->willReturn(array());
     $stepC->getArguments()->willReturn(array());
     $this->setArgumentResolver($argumentResolver);
     $this->setInterpreter($interpreter);
 }
 function it_throws_exception_if_first_argument_is_not_callable(Step $step)
 {
     $step->getIdentifier()->willReturn('step');
     $arguments = array(1, 2, 3);
     $this->shouldThrow('Devhelp\\Procedure\\Exception\\StepInterpretationException')->duringInterpret($step, $arguments);
 }
示例#4
0
 private function addToArguments(Step $step, $stepResult)
 {
     $this->argumentResolver->add($step->getIdentifier(), $stepResult);
 }