public function testIsAllowedWithErrors() { $currentConditionError = 'Current condition error'; $nestedConditionError = 'Nested condition error'; $this->condition->setMessage($currentConditionError); $falseConditionWithError = new Condition\False(); $falseConditionWithError->setMessage($nestedConditionError); $errors = new ArrayCollection(); $this->condition->initialize(array($falseConditionWithError)); $this->assertTrue($this->condition->isAllowed('anything', $errors)); $this->assertEquals(1, $errors->count()); $this->assertEquals(array('message' => $nestedConditionError, 'parameters' => array()), $errors->get(0)); $trueConditionWithError = new Condition\True(); $trueConditionWithError->setMessage($nestedConditionError); $errors = new ArrayCollection(); $this->condition->initialize(array($trueConditionWithError)); $this->assertFalse($this->condition->isAllowed('anything', $errors)); $this->assertEquals(1, $errors->count()); $this->assertEquals(array('message' => $currentConditionError, 'parameters' => array()), $errors->get(0)); }
/** * @expectedException \Oro\Bundle\WorkflowBundle\Exception\ConditionException * @expectedExceptionMessage Options are prohibited */ public function testInitializeFails() { $this->condition->initialize(array('anything')); }