Example #1
0
 public function testExecutePreConditionsAreNotMet()
 {
     $context = [];
     $conditionConfiguration = ['test' => []];
     $condition = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Model\\Condition\\Configurable')->disableOriginalConstructor()->getMock();
     $condition->expects($this->any())->method('evaluate')->with($context)->will($this->returnValue(false));
     $this->processDefinition->expects($this->once())->method('getPreConditionsConfiguration')->will($this->returnValue($conditionConfiguration));
     $this->conditionFactory->expects($this->once())->method('create')->with(ConfigurableCondition::ALIAS, $conditionConfiguration)->will($this->returnValue($condition));
     $this->processDefinition->expects($this->never())->method('getActionsConfiguration');
     $this->actionAssembler->expects($this->never())->method('assemble');
     $this->process->execute($context);
 }
Example #2
0
 public function testExecute()
 {
     $context = array('context');
     $configuration = array('config');
     $action = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Model\\Action\\ActionInterface')->getMock();
     $action->expects($this->exactly(2))->method('execute')->with($context);
     $processDefinition = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Entity\\ProcessDefinition')->disableOriginalConstructor()->getMock();
     $processDefinition->expects($this->once())->method('getActionsConfiguration')->will($this->returnValue($configuration));
     $actionAssembler = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Model\\Action\\ActionAssembler')->disableOriginalConstructor()->getMock();
     $actionAssembler->expects($this->once())->method('assemble')->will($this->returnValue($action));
     $process = new Process($actionAssembler, $processDefinition);
     $process->execute($context);
     $process->execute($context);
 }