Exemplo n.º 1
0
 /**
  * @dataProvider isAvailableDataProvider
  * @param bool $isAllowed
  * @param bool $isAvailable
  * @param bool $expected
  */
 public function testIsAvailableWithoutForm($isAllowed, $isAvailable, $expected)
 {
     $workflowItem = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Entity\\WorkflowItem')->disableOriginalConstructor()->getMock();
     $obj = new Transition();
     if (null !== $isAvailable) {
         $preCondition = $this->getMock('Oro\\Bundle\\WorkflowBundle\\Model\\Condition\\ConditionInterface');
         $preCondition->expects($this->any())->method('isAllowed')->with($workflowItem)->will($this->returnValue($isAvailable));
         $obj->setPreCondition($preCondition);
     }
     if (null !== $isAllowed) {
         $condition = $this->getMock('Oro\\Bundle\\WorkflowBundle\\Model\\Condition\\ConditionInterface');
         $condition->expects($this->any())->method('isAllowed')->with($workflowItem)->will($this->returnValue($isAllowed));
         $obj->setCondition($condition);
     }
     $this->assertEquals($expected, $obj->isAvailable($workflowItem));
 }