function testBeforeShouldTriggerActions() { $current_user = new MockUser(); $field_value_new = new MockTracker_FormElement_Field_List_Value(); $field_value_new->setReturnValue('getId', 2066); //'old_id' => null, //'field_id' => 2707, //'value' => 'New', //'description' => 'The bug has been submitted', //'rank' => '10'); $field_value_analyzed = new MockTracker_FormElement_Field_List_Value(); $field_value_analyzed->setReturnValue('getId', 2067); //'old_id' => null, //'field_id' => 2707, //'value' => 'Analyzed', //'description' => 'The bug is analyzed', //'rank' => '20'); $fields_data = array('field_id' => 'value'); $t1 = new Transition(1, 2, $field_value_new, $field_value_analyzed); $a1 = new MockTransition_PostAction(); $a2 = new MockTransition_PostAction(); $t1->setPostActions(array($a1, $a2)); $a1->expectOnce('before', array($fields_data, $current_user)); $a2->expectOnce('before', array($fields_data, $current_user)); $t1->before($fields_data, $current_user); }
function testBeforeShouldTriggerActions() { $current_user = mock('PFUser'); $field_value_new = new MockTracker_FormElement_Field_List_Value(); $field_value_new->setReturnValue('getId', 2066); $field_value_analyzed = new MockTracker_FormElement_Field_List_Value(); $field_value_analyzed->setReturnValue('getId', 2067); $fields_data = array('field_id' => 'value'); $t1 = new Transition(1, 2, $field_value_new, $field_value_analyzed); $t1->setConditions(new Workflow_Transition_ConditionsCollection()); $a1 = new MockTransition_PostAction(); $a2 = new MockTransition_PostAction(); $t1->setPostActions(array($a1, $a2)); $a1->expectOnce('before', array($fields_data, $current_user)); $a2->expectOnce('before', array($fields_data, $current_user)); $t1->before($fields_data, $current_user); }