public function testIsAllowed() { $options = array(); $workflowItem = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Entity\\WorkflowItem')->disableOriginalConstructor()->getMock(); $errors = $this->getMockForAbstractClass('Doctrine\\Common\\Collections\\Collection'); $realCondition = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Model\\Condition\\ConditionInterface')->getMockForAbstractClass(); $realCondition->expects($this->exactly(2))->method('isAllowed')->with($workflowItem, $errors)->will($this->returnValue(true)); $this->assembler->expects($this->once())->method('assemble')->with($options)->will($this->returnValue($realCondition)); $this->condition->initialize($options); $this->assertTrue($this->condition->isAllowed($workflowItem, $errors)); $this->assertTrue($this->condition->isAllowed($workflowItem, $errors)); }
public function testEvaluate() { $options = []; $workflowItem = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Entity\\WorkflowItem')->disableOriginalConstructor()->getMock(); $errors = $this->getMockForAbstractClass('Doctrine\\Common\\Collections\\Collection'); $realCondition = $this->getMockBuilder('Oro\\Component\\ConfigExpression\\ExpressionInterface')->getMockForAbstractClass(); $realCondition->expects($this->exactly(2))->method('evaluate')->with($workflowItem, $errors)->willReturn(true); $this->assembler->expects($this->once())->method('assemble')->with($options)->willReturn($realCondition); $this->condition->initialize($options); $this->assertTrue($this->condition->evaluate($workflowItem, $errors)); $this->assertTrue($this->condition->evaluate($workflowItem, $errors)); }