コード例 #1
0
 public function setUp()
 {
     parent::setUp();
     $this->trigger_value_id_1 = 369;
     $this->trigger_value_id_2 = 258;
     $this->rule = new Tracker_Workflow_Trigger_TriggerRule(null, new Tracker_Workflow_Trigger_FieldValue(aSelectBoxField()->withId(12)->build(), aBindStaticValue()->withId($this->target_value_id)->build()), Tracker_Workflow_Trigger_RulesBuilderData::CONDITION_AT_LEAST_ONE, array(new Tracker_Workflow_Trigger_FieldValue(aSelectBoxField()->withId(23)->build(), aBindStaticValue()->withId($this->trigger_value_id_1)->build()), new Tracker_Workflow_Trigger_FieldValue(aSelectBoxField()->withId(25)->build(), aBindStaticValue()->withId($this->trigger_value_id_2)->build())));
 }
コード例 #2
0
 public function setUp()
 {
     $this->field_122 = aSelectBoxField()->withId(122)->build();
     $this->field_123 = aSelectBoxField()->withId(123)->build();
     $this->field_124 = aSelectBoxField()->withId(124)->build();
     $this->status_field = aSelectBoxField()->withId(125)->build();
     $group_id = 234;
     $this->tracker = aMockTracker()->withId(3)->withProjectId($group_id)->build();
     $this->tracker_10 = aMockTracker()->withId(10)->withStatusField($this->status_field)->build();
     $this->tracker_20 = aMockTracker()->withId(20)->build();
     $project_trackers = array(3 => $this->tracker, 10 => $this->tracker_10, 20 => $this->tracker_20);
     $tracker_factory = stub('TrackerFactory')->getTrackersByGroupId($group_id)->returns($project_trackers);
     foreach ($project_trackers as $t) {
         stub($tracker_factory)->getTrackerById($t->getId())->returns($t);
     }
     $element_factory = mock('Tracker_FormElementFactory');
     stub($element_factory)->getFieldById(123)->returns($this->field_123);
     stub($element_factory)->getFieldById(124)->returns($this->field_124);
     stub($element_factory)->getUsedSbFields($this->tracker_10)->returns(array($this->field_122, $this->field_123));
     stub($element_factory)->getUsedSbFields()->returns(array());
     $this->dao = mock('Cardwall_OnTop_ColumnMappingFieldDao');
     $this->value_mapping_factory = mock('Cardwall_OnTop_Config_ValueMappingFactory');
     stub($this->value_mapping_factory)->getMappings()->returns(array());
     stub($this->value_mapping_factory)->getStatusMappings()->returns(array());
     $this->columns = new Cardwall_OnTop_Config_ColumnFreestyleCollection(array(new Cardwall_Column(1, 'Todo', 'white', 'black'), new Cardwall_Column(2, 'On Going', 'white', 'black'), new Cardwall_Column(3, 'Done', 'white', 'black')));
     $this->factory = new Cardwall_OnTop_Config_TrackerMappingFactory($tracker_factory, $element_factory, $this->dao, $this->value_mapping_factory);
 }
 public function setUp()
 {
     parent::setUp();
     $this->field_id = 12;
     $this->ugroup_manager = mock('UGroupManager');
     $this->value_dao = mock('Tracker_FormElement_Field_List_Bind_Ugroups_ValueDao');
     $this->default_value_dao = mock('Tracker_FormElement_Field_List_Bind_DefaultvalueDao');
     $this->field = aSelectBoxField()->withId($this->field_id)->build();
     $this->root = new SimpleXMLElement('<bind type="ugroups" />');
     $this->xml_mapping = array();
     $this->integrators_ugroup_id = 103;
     $this->integrators_ugroup_name = 'Integrators';
     $this->integrators_ugroup = new ProjectUGroup(array('ugroup_id' => $this->integrators_ugroup_id, 'name' => $this->integrators_ugroup_name));
     $this->integrators_ugroup_value = new Tracker_FormElement_Field_List_Bind_UgroupsValue(345, $this->integrators_ugroup, false);
     $this->customers_ugroup_id = 104;
     $this->customers_ugroup_name = 'Customers';
     $this->customers_ugroup = new ProjectUGroup(array('ugroup_id' => $this->customers_ugroup_id, 'name' => $this->customers_ugroup_name));
     $this->customers_ugroup_value = new Tracker_FormElement_Field_List_Bind_UgroupsValue(687, $this->customers_ugroup, false);
     $this->project_members_ugroup_name = 'ugroup_project_members_name_key';
     $this->project_members_ugroup = new ProjectUGroup(array('ugroup_id' => ProjectUGroup::PROJECT_MEMBERS, 'name' => $this->project_members_ugroup_name));
     $this->project_members_ugroup_value = new Tracker_FormElement_Field_List_Bind_UgroupsValue(4545, $this->project_members_ugroup, false);
     $this->hidden_ugroup_id = 105;
     $this->hidden_ugroup_name = 'Unused ProjectUGroup';
     $this->hidden_ugroup = new ProjectUGroup(array('ugroup_id' => $this->hidden_ugroup_id, 'name' => $this->hidden_ugroup_name));
     $this->hidden_ugroup_value = new Tracker_FormElement_Field_List_Bind_UgroupsValue(666, $this->hidden_ugroup, true);
 }
コード例 #4
0
 public function testImport()
 {
     $xml = simplexml_load_file(dirname(__FILE__) . '/_fixtures/importWorkflow.xml');
     $tracker = new MockTracker();
     $mapping = array('F1' => aSelectBoxField()->withId(110)->build(), 'F32' => aSelectBoxField()->withId(111)->build(), 'F32-V0' => 801, 'F32-V1' => 802);
     $condition_factory = mock('Workflow_Transition_ConditionFactory');
     stub($condition_factory)->getAllInstancesFromXML()->returns(new Workflow_Transition_ConditionsCollection());
     $transition_factory = mock('TransitionFactory');
     $third_transition = mock('Transition');
     $date_post_action = mock('Transition_PostAction_Field_Date');
     stub($date_post_action)->getField()->returns(110);
     stub($date_post_action)->getValueType()->returns(1);
     stub($third_transition)->getPostActions()->returns(array($date_post_action));
     stub($transition_factory)->getInstanceFromXML($xml->transitions->transition[0], $mapping)->at(0)->returns(mock('Transition'));
     stub($transition_factory)->getInstanceFromXML($xml->transitions->transition[1], $mapping)->at(1)->returns(mock('Transition'));
     stub($transition_factory)->getInstanceFromXML($xml->transitions->transition[2], $mapping)->at(2)->returns($third_transition);
     $workflow_factory = new WorkflowFactory($transition_factory, mock('TrackerFactory'), mock('Tracker_FormElementFactory'), mock('Tracker_Workflow_Trigger_RulesManager'), mock('WorkflowBackendLogger'));
     $workflow = $workflow_factory->getInstanceFromXML($xml, $mapping, $tracker);
     $this->assertEqual($workflow->getIsUsed(), 1);
     $this->assertEqual($workflow->getFieldId(), 111);
     $this->assertEqual(count($workflow->getTransitions()), 3);
     // Test post actions
     $transitions = $workflow->getTransitions();
     $this->assertEqual(count($transitions[0]->getPostActions()), 0);
     $this->assertEqual(count($transitions[1]->getPostActions()), 0);
     $this->assertEqual(count($transitions[2]->getPostActions()), 1);
     // There is one post action on last transition
     $postactions = $transitions[2]->getPostActions();
     $this->assertEqual($postactions[0]->getField(), 110);
     $this->assertEqual($postactions[0]->getValueType(), 1);
     $this->assertEqual($third_transition, $transitions[2]);
 }
コード例 #5
0
 public function itAddsANewValue()
 {
     $field = aSelectBoxField()->withId(101)->build();
     $is_rank_alpha = $values = $default_values = $decorators = '';
     $value_dao = new MockTracker_FormElement_Field_List_Bind_Static_ValueDao();
     $value_dao->setReturnValue('create', 321);
     $bind_static = partial_mock('Tracker_FormElement_Field_List_Bind_Static', array('getValueDao'), array($field, $is_rank_alpha, $values, $default_values, $decorators));
     $bind_static->setReturnValue('getValueDao', $value_dao);
     $value_dao->expect('create', array(101, 'intermodulation', '*', '*', '*'));
     $new_id = $bind_static->addValue(' intermodulation	');
     $this->assertEqual($new_id, 321);
 }
コード例 #6
0
 public function setUp()
 {
     parent::setUp();
     $this->parent = mock('Tracker_Artifact');
     $this->task_tracker = aTracker()->withId(899)->build();
     $this->artifact = anArtifact()->withChangesets(array(mock('Tracker_Artifact_Changeset')))->withParentWithoutPermissionChecking($this->parent)->withTracker($this->task_tracker)->build();
     $this->user = aUser()->build();
     $this->rules_processor = partial_mock('Tracker_Workflow_Trigger_RulesProcessor', array('getRuleStrategy'), array(new Tracker_Workflow_WorkflowUser(), mock('WorkflowBackendLogger')));
     $this->target_field_id = 569;
     $this->target_field = aSelectBoxField()->withId($this->target_field_id)->build();
     $this->target_value_id = 7;
     $this->target_value = aBindStaticValue()->withId($this->target_value_id)->build();
     $this->rule = aTriggerRule()->applyValue(new Tracker_Workflow_Trigger_FieldValue($this->target_field, $this->target_value))->whenAtLeastOne()->childHas(mock('Tracker_Workflow_Trigger_FieldValue'))->build();
 }
コード例 #7
0
ファイル: ConfigTest.php プロジェクト: nterray/tuleap
 public function setUp()
 {
     parent::setUp();
     $value_none = new Tracker_FormElement_Field_List_Bind_StaticValue(100, 'None', '', 0, 0);
     $value_todo = new Tracker_FormElement_Field_List_Bind_StaticValue(101, 'Todo', '', 0, 0);
     $value_inprogress = new Tracker_FormElement_Field_List_Bind_StaticValue(102, 'In Progress', '', 0, 0);
     $value_done = new Tracker_FormElement_Field_List_Bind_StaticValue(103, 'Done', '', 0, 0);
     $mapping_none = new Cardwall_OnTop_Config_ValueMapping($value_none, 10);
     $mapping_todo = new Cardwall_OnTop_Config_ValueMapping($value_todo, 10);
     $mapping_ongoing = new Cardwall_OnTop_Config_ValueMapping($value_inprogress, 11);
     $mapping_done = new Cardwall_OnTop_Config_ValueMapping($value_done, 12);
     $this->value_mappings = array(100 => $mapping_none, 101 => $mapping_todo, 102 => $mapping_ongoing, 103 => $mapping_done);
     $this->mapping = new Cardwall_OnTop_Config_TrackerMappingStatus(mock('Tracker'), array(), $this->value_mappings, aSelectBoxField()->build());
     $this->config = partial_mock('Cardwall_OnTop_Config', array('getMappingFor'));
     $this->artifact = aMockArtifact()->withTracker(aTracker()->build())->build();
 }
コード例 #8
0
 public function setUp()
 {
     parent::setUp();
     $this->tracker_id = 666;
     $tracker = mock('Tracker');
     stub($tracker)->getId()->returns($this->tracker_id);
     $bug_tracker = mock('Tracker');
     stub($bug_tracker)->getId()->returns(13);
     $task_tracker = mock('Tracker');
     stub($task_tracker)->getId()->returns(42);
     $story_tracker = mock('Tracker');
     stub($story_tracker)->getId()->returns(69);
     $tracker_factory = mock('TrackerFactory');
     stub($tracker_factory)->getTrackerById(13)->returns($bug_tracker);
     stub($tracker_factory)->getTrackerById(42)->returns($task_tracker);
     stub($tracker_factory)->getTrackerById(69)->returns($story_tracker);
     $existing_mappings = array(13 => new Cardwall_OnTop_Config_TrackerMappingNoField($bug_tracker, array()), 42 => new Cardwall_OnTop_Config_TrackerMappingNoField($task_tracker, array()), 69 => new Cardwall_OnTop_Config_TrackerMappingFreestyle($story_tracker, array(), array(), aSelectBoxField()->build()));
     $this->dao = mock('Cardwall_OnTop_ColumnMappingFieldDao');
     $this->value_dao = mock('Cardwall_OnTop_ColumnMappingFieldValueDao');
     $this->command = new Cardwall_OnTop_Config_Command_DeleteMappingFields($tracker, $this->dao, $this->value_dao, $tracker_factory, $existing_mappings);
 }
コード例 #9
0
 public function setUp()
 {
     parent::setUp();
     $this->bind = mock('Tracker_FormElement_Field_List_Bind_Static');
     $this->field = aSelectBoxField()->withBind($this->bind)->build();
 }
コード例 #10
0
 public function setUp()
 {
     parent::setUp();
     stub($this->element_factory)->getFormElementById(2065)->returns(aSelectBoxField()->withId(2065)->build());
     stub($this->element_factory)->getFormElementById(2066)->returns(aSelectBoxField()->withId(2066)->build());
     stub($this->element_factory)->getFormElementById(2067)->returns(aSelectBoxField()->withId(2067)->build());
     stub($this->date_dao)->searchByTransitionId($this->transition_id)->returnsEmptyDar();
     stub($this->float_dao)->searchByTransitionId($this->transition_id)->returnsDar(array('id' => 1, 'field_id' => 2065, 'value' => 0));
     stub($this->int_dao)->searchByTransitionId($this->transition_id)->returnsDar(array('id' => 1, 'field_id' => 2066, 'value' => 666), array('id' => 2, 'field_id' => 2067, 'value' => 42));
 }
コード例 #11
0
 public function itDoesntMapOnNoneIfItsNotExplicitlyConfigured()
 {
     $mapping = new Cardwall_OnTop_Config_TrackerMappingStatus(mock('Tracker'), array(), $this->value_mappings, aSelectBoxField()->build());
     $column = new Cardwall_Column(100, 'None', '', '');
     $this->assertFalse($mapping->isMappedTo($column, null));
 }
 public function setUp()
 {
     parent::setUp();
     $this->mapping = array();
     $this->project = mock('Project');
     $this->field = aSelectBoxField()->withTracker(aTracker()->withProject($this->project)->build())->build();
     $this->ugroup_manager = mock('UGroupManager');
     $this->value_dao = mock('Tracker_FormElement_Field_List_Bind_Ugroups_ValueDao');
     $this->bind_factory = new Tracker_FormElement_Field_List_BindFactory($this->ugroup_manager);
     $this->bind_factory->setUgroupsValueDao($this->value_dao);
     $this->setText('Registered users', array('project_ugroup', 'ugroup_registered_users_name_key'));
 }
 public function itDoesntCrashWhenInvalidValueShouldBePrinted()
 {
     $field = aSelectBoxField()->withId(101)->build();
     $bind = new Tracker_FormElement_Field_List_Bind_Static($field, 0, array(), null, null);
     $this->assertEqual('-', $bind->formatArtifactValue(0));
 }
コード例 #14
0
 public function setUp()
 {
     parent::setUp();
     $this->tracker_id = 274;
     $this->tracker_name = 'Target Tracker Name';
     $this->target_field_id = 30;
     $this->target_value_id = 250;
     $target_field_value = aBindStaticValue()->withId($this->target_value_id)->withLabel('Target Value Label')->build();
     $target_field = aSelectBoxField()->withId($this->target_field_id)->withLabel('Target Field Label')->withTracker(aTracker()->withId($this->tracker_id)->withName($this->tracker_name)->build())->withBind(aBindStatic()->withValues(array($target_field_value))->build())->build();
     stub($this->formelement_factory)->getUsedFormElementFieldById("{$this->target_field_id}")->returns($target_field);
     // field 1
     $this->trigger_field_id_1 = 369;
     $this->trigger_field_value_1 = aBindStaticValue()->withId(852)->withLabel('Triggering Value Label 1')->build();
     $this->trigger_field_1 = aSelectBoxField()->withId($this->trigger_field_id_1)->withLabel('Triggering Field Label 1')->withTracker(aTracker()->withId(69)->withName('Triggering Tracker 1')->withParent($this->tracker)->build())->withBind(aBindStatic()->withValues(array($this->trigger_field_value_1))->build())->build();
     stub($this->formelement_factory)->getUsedFormElementFieldById("{$this->trigger_field_id_1}")->returns($this->trigger_field_1);
 }
コード例 #15
0
 public function setUp()
 {
     parent::setUp();
     $this->bug_tracker = aTracker()->withId(901)->build();
     $this->trigger_field_2 = aSelectBoxField()->withId(236)->withTracker($this->bug_tracker)->build();
     $this->trigger_value_2 = aBindStaticValue()->withId(28)->build();
     $this->complex_rule = aTriggerRule()->applyValue(new Tracker_Workflow_Trigger_FieldValue($this->target_field, $this->target_value))->whenAllOf()->childHas(new Tracker_Workflow_Trigger_FieldValue($this->trigger_field, $this->trigger_value))->childHas(new Tracker_Workflow_Trigger_FieldValue($this->trigger_field_2, $this->trigger_value_2))->build();
     $this->strategy = new Tracker_Workflow_Trigger_RulesProcessor_AllOfStrategy($this->artifact, $this->complex_rule);
 }