public function setUp()
 {
     parent::setUp();
     /*
     Product          Epic
       Release  ----,-- Story
         Sprint ---'      Task
     */
     $this->user = aUser()->build();
     $this->release_tracker_id = 101;
     $this->sprint_tracker_id = 1001;
     $this->task_tracker_project_id = 200;
     $this->epic_tracker = aTracker()->withId('epic')->withParent(null)->build();
     $this->story_tracker = aTracker()->withId('story')->withParent($this->epic_tracker)->build();
     $this->task_tracker = aTracker()->withId('task')->withProjectId($this->task_tracker_project_id)->withParent($this->story_tracker)->build();
     $this->product_tracker = aTracker()->withId('product')->withParent(null)->build();
     $this->release_tracker = aTracker()->withId($this->release_tracker_id)->withParent($this->product_tracker)->build();
     $this->sprint_tracker = aTracker()->withId($this->sprint_tracker_id)->withParent($this->epic_tracker)->build();
     $release_planning = stub('Planning')->getPlanningTracker()->returns($this->release_tracker);
     $sprint_planning = stub('Planning')->getPlanningTracker()->returns($this->sprint_tracker);
     $top_planning = stub('Planning')->getBacklogTrackersIds()->returns(array($this->release_tracker_id, $this->sprint_tracker_id));
     $this->planning_factory = mock('PlanningFactory');
     stub($this->planning_factory)->getPlanningByPlanningTracker($this->product_tracker)->returns(null);
     stub($this->planning_factory)->getPlanningByPlanningTracker($this->release_tracker)->returns($release_planning);
     stub($this->planning_factory)->getPlanningByPlanningTracker($this->sprint_tracker)->returns($sprint_planning);
     stub($this->planning_factory)->getVirtualTopPlanning($this->user, $this->task_tracker_project_id)->returns($top_planning);
     $this->hierarchy_factory = mock('Tracker_HierarchyFactory');
     stub($this->hierarchy_factory)->getAllParents($this->sprint_tracker)->returns(array($this->release_tracker, $this->product_tracker));
     $this->dao = mock('AgileDashboard_Milestone_MilestoneDao');
     stub($this->dao)->getAllMilestoneByTrackers(array($this->release_tracker_id, $this->sprint_tracker_id))->returnsDar(array('m101_id' => '123', 'm101_title' => 'Tuleap 6.5', 'm1001_id' => '1231', 'm1001_title' => 'Sprint 31'), array('m101_id' => '123', 'm101_title' => 'Tuleap 6.5', 'm1001_id' => '1232', 'm1001_title' => 'Sprint 32'), array('m101_id' => '124', 'm101_title' => 'Tuleap 6.6', 'm1001_id' => '1241', 'm1001_title' => 'Sprint 33'));
     $this->nearest_planning_tracker_provider = mock('AgileDashboard_Planning_NearestPlanningTrackerProvider');
     $this->provider = new AgileDashboard_Milestone_MilestoneReportCriterionOptionsProvider($this->nearest_planning_tracker_provider, $this->dao, $this->hierarchy_factory, $this->planning_factory);
 }
Ejemplo n.º 2
0
 public function setUp()
 {
     parent::setUp();
     $tracker_factory = mock('TrackerFactory');
     $this->xml_importer = mock('Tracker_Artifact_XMLImport');
     $this->artifact_factory = mock('Tracker_ArtifactFactory');
     $this->children_collector = new Tracker_XML_ChildrenCollector();
     $this->importer = new Tracker_XML_Importer_ChildrenXMLImporter($this->xml_importer, $tracker_factory, $this->artifact_factory, $this->children_collector);
     $this->artifacts_imported_mapping = mock('Tracker_XML_Importer_ArtifactImportedMapping');
     $this->tracker = aTracker()->withId(23)->build();
     stub($tracker_factory)->getTrackerById(23)->returns($this->tracker);
     $this->tracker_2 = aTracker()->withId(24)->build();
     stub($tracker_factory)->getTrackerById(24)->returns($this->tracker_2);
     $this->user = aUser()->build();
     $artlink_field = anArtifactLinkField()->withId($this->field_id)->build();
     $artlink_field_2 = anArtifactLinkField()->withId($this->field_id_2)->build();
     $root_artifact_id = 456;
     $this->root_artifact = mock('Tracker_Artifact');
     stub($this->root_artifact)->getId()->returns($root_artifact_id);
     stub($this->root_artifact)->getAnArtifactLinkField($this->user)->returns($artlink_field);
     stub($this->artifact_factory)->getArtifactById($root_artifact_id)->returns($this->root_artifact);
     $this->created_artifact = mock('Tracker_Artifact');
     stub($this->created_artifact)->getId()->returns(1023);
     stub($this->created_artifact)->getAnArtifactLinkField($this->user)->returns($artlink_field_2);
     stub($this->artifact_factory)->getArtifactById(1023)->returns($this->created_artifact);
     $this->another_child_artifact = anArtifact()->withId(1024)->build();
     stub($this->artifact_factory)->getArtifactById(1024)->returns($this->another_child_artifact);
 }
 public function setUp()
 {
     /*
                    Epic
     Release  ----,-- Story
       Sprint ---'      Task
     */
     $this->epic_tracker = aTracker()->withId('epic')->withParent(null)->build();
     $this->story_tracker = aTracker()->withId('story')->withParent($this->epic_tracker)->build();
     $this->task_tracker = aTracker()->withId('task')->withParent($this->story_tracker)->build();
     $this->release_tracker = aTracker()->withId('release')->withParent(null)->build();
     $this->sprint_tracker = aTracker()->withId('sprint')->withParent($this->epic_tracker)->build();
     $release_planning = stub('Planning')->getPlanningTracker()->returns($this->release_tracker);
     stub($release_planning)->getPlanningTrackerId()->returns('release');
     $sprint_planning = stub('Planning')->getPlanningTracker()->returns($this->sprint_tracker);
     stub($sprint_planning)->getPlanningTrackerId()->returns('sprint');
     $this->hierarchy = mock('Tracker_Hierarchy');
     stub($this->hierarchy)->sortTrackerIds()->returns(array('release', 'sprint'));
     $this->hierarchy_factory = mock('Tracker_HierarchyFactory');
     stub($this->hierarchy_factory)->getHierarchy()->returns($this->hierarchy);
     $this->planning_factory = mock('PlanningFactory');
     stub($this->planning_factory)->getPlanningsByBacklogTracker($this->task_tracker)->returns(array());
     stub($this->planning_factory)->getPlanningsByBacklogTracker($this->story_tracker)->returns(array($sprint_planning, $release_planning));
     stub($this->planning_factory)->getPlanningsByBacklogTracker($this->epic_tracker)->returns(array());
     $this->provider = new AgileDashboard_Planning_NearestPlanningTrackerProvider($this->planning_factory);
 }
 public function testImportFormElement()
 {
     $xml = new SimpleXMLElement('<?xml version="1.0" standalone="yes"?>
         <formElement type="mon_type" ID="F0" rank="20" required="1">
             <name>field_name</name>
             <label>field_label</label>
             <description>field_description</description>
             <formElements>
                 <formElement type="date" ID="F1" rank="1" required="1">
                     <name>date</name>
                     <label>date</label>
                     <description>date</description>
                 </formElement>
             </formElements>
         </formElement>');
     $mapping = array();
     $a_formelement = new MockTracker_FormElement_Field_Date();
     $factory = new MockTracker_FormElementFactory();
     $factory->setReturnReference('getInstanceFromXML', $a_formelement);
     $f = new Tracker_FormElement_Container_FieldsetTestVersion();
     $f->setTracker(aTracker()->withProject(mock('Project'))->build());
     $f->setReturnReference('getFormElementFactory', $factory);
     $f->continueGetInstanceFromXML($xml, $mapping);
     $container_should_load_child = array($a_formelement);
     $this->assertEqual($f->getFormElements(), $container_should_load_child);
 }
Ejemplo n.º 5
0
 public function testEditListsAllChildren()
 {
     $possible_children = array('1' => aTracker()->withId(1)->withName('Bugs')->build(), '2' => aTracker()->withId(2)->withName('Tasks')->build());
     $this->factory->setReturnValue('getPossibleChildren', $possible_children, array($this->hierarchical_tracker));
     $this->factory->setReturnValue('getHierarchy', $this->getHierarchyAsTreeNode(array()));
     $content = $this->WhenICaptureTheOutputOfEditAction();
     $this->assertContainsAll(array('value="1".*Bugs', 'value="2".*Tasks'), $content);
 }
 public function setUp()
 {
     parent::setUp();
     $this->tracker = aTracker()->build();
     $this->artifact_builder = anArtifact()->withTracker($this->tracker)->withChangesets(array(new Tracker_Artifact_Changeset_Null()));
     $this->formelement_factory = mock('Tracker_FormElementFactory');
     $this->initializator = new Tracker_Artifact_Changeset_ChangesetDataInitializator($this->formelement_factory);
 }
Ejemplo n.º 7
0
 public function setUp()
 {
     $this->planning = mock('Planning');
     $this->tracker = aTracker()->build();
     $this->tracker_id = $this->tracker->getId();
     $this->other_tracker_id = $this->tracker->getId() + 1;
     $this->presenter = new Planning_TrackerPresenter($this->planning, $this->tracker);
 }
Ejemplo n.º 8
0
 public function itHasAllTriggeringFields()
 {
     $child_tracker = aTracker()->withId(200)->build();
     $this->target_tracker->setChildren(array($child_tracker));
     expect($this->formelement_factory)->getUsedStaticSbFields()->count(2);
     expect($this->formelement_factory)->getUsedStaticSbFields($child_tracker)->at(1);
     stub($this->formelement_factory)->getUsedStaticSbFields()->returnsEmptyDar();
     $this->factory->getForTracker($this->target_tracker);
 }
 public function setUp()
 {
     parent::setUp();
     $this->tracker_id = 12;
     $this->tracker = aTracker()->withId($this->tracker_id)->build();
     $this->user_id = 32;
     $this->user = aUser()->withId($this->user_id)->build();
     $this->report_factory = partial_mock('Tracker_ReportFactory', array('getReportsByTrackerId'));
 }
 public function setUp()
 {
     parent::setUp();
     $this->task_tracker = aTracker()->withId('task')->build();
     $this->options_provider = mock('AgileDashboard_Milestone_MilestoneReportCriterionOptionsProvider');
     $this->milestone_id_provider = mock('AgileDashboard_Milestone_SelectedMilestoneProvider');
     $this->user = aUser()->build();
     $this->provider = new AgileDashboard_Milestone_MilestoneReportCriterionProvider($this->milestone_id_provider, $this->options_provider);
 }
 public function setUp()
 {
     parent::setUp();
     $this->client = mock('FullTextSearch_IIndexDocuments');
     $this->tracker_data_factory = mock('ElasticSearch_1_2_RequestTrackerDataFactory');
     $this->logger = mock('Logger');
     $this->tracker = aTracker()->withId(455)->build();
     $this->artifact = anArtifact()->withId(44)->withTracker($this->tracker)->build();
     $this->actions = new FullTextSearchTrackerActions($this->client, $this->tracker_data_factory, $this->logger);
 }
 public function setUp()
 {
     parent::setUp();
     $this->field = mock('Tracker_FormElement_Field_Date');
     $this->reminder = mock('Tracker_DateReminder');
     stub($this->reminder)->getField()->returns($this->field);
     $this->today_at_midnight = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
     $this->tracker_id = 158;
     $this->reminder_manager = new Tracker_DateReminderManager(aTracker()->withId($this->tracker_id)->build());
 }
 public function setUp()
 {
     parent::setUp();
     $project = stub('Project')->getId()->returns(1478);
     $this->tracker = aTracker()->withId(888)->withProject($project)->build();
     $this->user = aUser()->withId(111)->build();
     $this->changeset = mock('Tracker_Artifact_Changeset');
     $this->artifact = anArtifact()->withTracker($this->tracker)->withChangesets(array($this->changeset))->build();
     $this->formelement_factory = mock('Tracker_FormElementFactory');
     $this->builder = new Tracker_REST_Artifact_ArtifactRepresentationBuilder($this->formelement_factory);
 }
Ejemplo n.º 14
0
 public function setUp()
 {
     $this->reference_manager = mock('ReferenceManager');
     $this->artifact_factory = mock('Tracker_ArtifactFactory');
     $this->tracker_reference_manager = new Tracker_ReferenceManager($this->reference_manager, $this->artifact_factory);
     $this->keyword = 'art';
     $this->artifact_id = 101;
     $tracker = aTracker()->withId(101)->withName('My tracker')->build();
     $this->artifact = anArtifact()->withId(101)->withTracker($tracker)->build();
     $GLOBALS['Language'] = mock('BaseLanguage');
 }
Ejemplo n.º 15
0
 public function itReturnsNullIfThereIsACustomMappingButNoFieldChoosenYet()
 {
     $tracker = aTracker()->build();
     $artifact = aMockArtifact()->withTracker($tracker)->build();
     $status_field = mock('Tracker_FormElement_Field_OpenList');
     $status_retriever = stub('Cardwall_FieldProviders_SemanticStatusFieldRetriever')->getField()->returns($status_field);
     $mapping = stub('Cardwall_OnTop_Config_TrackerMapping')->getField()->returns(null);
     $config = stub('Cardwall_OnTop_Config')->getMappingFor($tracker)->returns($mapping);
     $provider = new Cardwall_OnTop_Config_MappedFieldProvider($config, $status_retriever);
     $this->assertEqual(null, $provider->getField($artifact));
 }
 public function setUp()
 {
     parent::setUp();
     $this->milestone = aMilestone()->withArtifact(anArtifact()->withId(3)->build())->build();
     $this->backlog_tracker = aTracker()->withId(35)->build();
     $this->dao = mock('Tracker_ArtifactDao');
     $this->user = aUser()->build();
     $this->strategy_factory = mock('AgileDashboard_Milestone_Backlog_BacklogStrategyFactory');
     $this->backlog_item_collection_factory = mock('AgileDashboard_Milestone_Backlog_BacklogItemCollectionFactory');
     $this->provider = new AgileDashboard_BacklogItem_SubBacklogItemProvider($this->dao, $this->strategy_factory, $this->backlog_item_collection_factory);
 }
 public function setUp()
 {
     parent::setUp();
     $this->tracker = aTracker()->withId(101)->build();
     $this->field_int = new Tracker_FormElement_Field_Integer(1, 101, null, 'field_int', 'Field Integer', '', 1, 'P', true, '', 1);
     $this->field_float = new Tracker_FormElement_Field_Float(2, 101, null, 'field_float', 'Field Float', '', 1, 'P', true, '', 1);
     $this->field_string = new Tracker_FormElement_Field_String(3, 101, null, 'field_string', 'Field String', '', 1, 'P', true, '', 1);
     $this->field_text = new Tracker_FormElement_Field_Text(4, 101, null, 'field_text', 'Field Text', '', 1, 'P', true, '', 1);
     $this->field_msb = new Tracker_FormElement_Field_MultiSelectbox(5, 101, null, 'field_msb', 'Field MSB', '', 1, 'P', true, '', 1);
     $this->form_element_factory = mock('Tracker_FormElementFactory');
     $this->validator = new Tracker_REST_Artifact_ArtifactValidator($this->form_element_factory);
 }
 public function itReturnsAnErrorCodeWhenItHasNoArtifactLinkField()
 {
     $tracker = aTracker()->withId(456)->withProjectId(120)->build();
     $artifact = $this->GivenAnArtifact($tracker);
     $factory = stub('Tracker_FormElementFactory')->getUsedArtifactLinkFields($tracker)->returns(array());
     $artifact->setFormElementFactory($factory);
     $artifact->expectNever('createNewChangeset');
     $GLOBALS['Response']->expectOnce('sendStatusCode', array(400));
     $GLOBALS['Language']->setReturnValue('getText', 'The destination artifact must have a artifact link field.', array('plugin_tracker', 'must_have_artifact_link_field'));
     $this->expectFeedback('error', 'The destination artifact must have a artifact link field.');
     $artifact->process(new MockTrackerManager(), $this->request, $this->user);
 }
 public function itComputesRemainingEffortAtAGivenTime()
 {
     $timestamp = mktime(23, 59, 59, 7, 3, 2012);
     $sub_artifact1 = anArtifact()->withId(1)->withTracker(aTracker()->build())->build();
     $sub_artifact2 = anArtifact()->withId(2)->withTracker(aTracker()->build())->build();
     $artifact = stub('Tracker_Artifact')->getLinkedArtifacts()->returns(array($sub_artifact1, $sub_artifact2));
     $field = mock('Tracker_FormElement_Field_Float');
     stub($field)->getComputedValue($this->user, $sub_artifact1, $timestamp, '*')->returns(5);
     stub($field)->getComputedValue($this->user, $sub_artifact2, $timestamp, '*')->returns(15);
     stub($this->formelement_factory)->getComputableFieldByNameForUser()->returns($field);
     $this->assertEqual(20, $this->field->getComputedValue($this->user, $artifact, $timestamp));
 }
Ejemplo n.º 20
0
 public function setUp()
 {
     parent::setUp();
     $this->sprint_planning = aPlanning()->withBacklogTracker(aTracker()->build())->build();
     $this->sprint_1 = mock('Planning_Milestone');
     stub($this->sprint_1)->hasAncestors()->returns(true);
     $this->sprint_2 = aMilestone()->withArtifact(aMockArtifact()->withId(1234)->build())->build();
     $this->milestone_factory = mock('Planning_MilestoneFactory');
     $this->current_user = aUser()->build();
     $this->request = aRequest()->withUser($this->current_user)->build();
     $this->pane_presenter_builder_factory = mock('AgileDashboard_Milestone_Pane_PanePresenterBuilderFactory');
     stub($this->pane_presenter_builder_factory)->getContentPresenterBuilder()->returns(mock('AgileDashboard_Milestone_Pane_Content_ContentPresenterBuilder'));
     stub($this->pane_presenter_builder_factory)->getPlanningPresenterBuilder()->returns(mock('AgileDashboard_Milestone_Pane_Planning_PlanningPresenterBuilder'));
 }
Ejemplo n.º 21
0
 public function itHasATriggerTrackerWithAField()
 {
     $field_id = 693;
     $field = aMockField()->withId($field_id)->build();
     expect($field)->fetchFormattedForJson()->once();
     stub($field)->fetchFormattedForJson()->returns('whatever');
     $tracker_id = 90;
     $triggering_field = new Tracker_Workflow_Trigger_RulesBuilderTriggeringFields(aTracker()->withId($tracker_id)->withName('Tasks')->build(), new ArrayIterator(array($field)));
     $rules_builder_data = new Tracker_Workflow_Trigger_RulesBuilderData(new ArrayIterator(), array($triggering_field));
     $result = $rules_builder_data->fetchFormattedForJson();
     $trigger = $result['triggers'][$tracker_id];
     $this->assertCount($trigger['fields'], 1);
     $this->assertEqual($trigger['fields'][$field_id], 'whatever');
 }
Ejemplo n.º 22
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();
 }
 public function setUp()
 {
     parent::setUp();
     $this->template_ugroup_dev = stub('ProjectUGroup')->getName()->returns('dev');
     $this->template_ugroup_support = stub('ProjectUGroup')->getName()->returns('support');
     $this->target_ugroup_dev = stub('ProjectUGroup')->getName()->returns('dev');
     $this->target_ugroup_support = stub('ProjectUGroup')->getName()->returns('support');
     $template_project = stub('Project')->getId()->returns(103);
     $this->template_tracker = aTracker()->withProject($template_project)->build();
     $this->target_project = stub('Project')->getId()->returns(104);
     $this->ugroup_manager = mock('UGroupManager');
     $this->messenger = mock('Tracker_UgroupPermissionsConsistencyMessenger');
     $this->permissions_retriever = mock('Tracker_UgroupPermissionsGoldenRetriever');
     $this->checker = new Tracker_UgroupPermissionsConsistencyChecker($this->permissions_retriever, $this->ugroup_manager, $this->messenger);
 }
Ejemplo n.º 24
0
 public function setUp()
 {
     parent::setUp();
     $this->tmp_dir = '/var/tmp';
     $this->fixtures_dir = dirname(__FILE__) . '/_fixtures';
     $this->tracker_id = getmypid();
     // to be sure that there is no overlap
     // with other tests executed on the
     // same platform
     $this->tracker = aTracker()->withId($this->tracker_id)->build();
     $this->zip = new ZipArchive();
     if ($this->zip->open($this->fixtures_dir . '/archive.zip') !== true) {
         $this->fail('unable to open fixture archive.zip');
     }
     $this->archive = new Tracker_Artifact_XMLImport_XMLImportZipArchive($this->tracker, $this->zip, $this->tmp_dir);
 }
Ejemplo n.º 25
0
 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();
 }
Ejemplo n.º 26
0
 public function setUp()
 {
     parent::setUp();
     $this->project_id = 101;
     $this->kanban_id = 2;
     $this->tracker_id = 4;
     $this->column_id = 456;
     $this->user = aUser()->build();
     $this->tracker = aTracker()->withProjectId($this->project_id)->withId($this->tracker_id)->build();
     $this->column = new AgileDashboard_KanbanColumn($this->column_id, $this->kanban_id, "Todo", true, null, 2);
     $this->column_dao = mock("AgileDashboard_KanbanColumnDao");
     $this->tracker_factory = stub("TrackerFactory")->getTrackerById($this->tracker_id)->returns($this->tracker);
     $this->permissions_manager = mock("AgileDashboard_PermissionsManager");
     $this->kanban = new AgileDashboard_Kanban($this->kanban_id, $this->tracker_id, "My Kanban");
     $this->kanban_column_manager = new AgileDashboard_KanbanColumnManager($this->column_dao, $this->permissions_manager, $this->tracker_factory);
 }
Ejemplo n.º 27
0
 public function testGetPossibleChildrenReturnsAttributesForSelect()
 {
     $possible_children = array(1 => aTracker()->withId(1)->withName('Stories')->build(), 2 => aTracker()->withId(2)->withName('Tasks')->build());
     $tracker = new MockTracker_Hierarchy_HierarchicalTracker();
     $tracker->setReturnValue('getUnhierarchizedTracker', aTracker()->build());
     $tracker->setReturnValue('hasChild', false, array($possible_children[1]));
     $tracker->setReturnValue('hasChild', true, array($possible_children[2]));
     $presenter = new Tracker_Hierarchy_Presenter($tracker, $possible_children, new TreeNode(), array());
     $attributes = $presenter->getPossibleChildren();
     $this->assertEqual($attributes[0]['name'], 'Stories');
     $this->assertEqual($attributes[0]['id'], 1);
     $this->assertEqual($attributes[0]['selected'], null);
     $this->assertEqual($attributes[1]['name'], 'Tasks');
     $this->assertEqual($attributes[1]['id'], 2);
     $this->assertEqual($attributes[1]['selected'], 'selected="selected"');
 }
Ejemplo n.º 28
0
 public function setUp()
 {
     parent::setUp();
     $this->artifact_xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?>' . '<artifact>' . '  <changeset>' . '    <submitted_on>2014</submitted_on>' . '    <submitted_by>123</submitted_by>' . '    <field_change field_name="summary">' . '      <value>Initial summary value</value>' . '    </field_change>' . '    <field_change field_name="effort">' . '      <value>125</value>' . '    </field_change>' . '    <field_change field_name="details">' . '      <value>Content of details</value>' . '    </field_change>' . '  </changeset>' . '</artifact>');
     $this->visitor = mock('Tracker_XML_Updater_FieldChangeXMLUpdaterVisitor');
     $this->formelement_factory = mock('Tracker_FormElementFactory');
     $this->updater = new Tracker_XML_Updater_ChangesetXMLUpdater($this->visitor, $this->formelement_factory);
     $this->user = aUser()->withId($this->user_id)->build();
     $this->tracker = aTracker()->withId($this->tracker_id)->build();
     $this->submitted_values = array(1001 => 'Content of summary field', 1002 => '123');
     $this->field_summary = aStringField()->withId(1001)->build();
     $this->field_effort = aStringField()->withId(1002)->build();
     $this->field_details = aStringField()->withId(1003)->build();
     stub($this->formelement_factory)->getUsedFieldByNameForUser($this->tracker_id, 'summary', $this->user)->returns($this->field_summary);
     stub($this->formelement_factory)->getUsedFieldByNameForUser($this->tracker_id, 'effort', $this->user)->returns($this->field_effort);
     stub($this->formelement_factory)->getUsedFieldByNameForUser($this->tracker_id, 'details', $this->user)->returns($this->field_details);
 }
Ejemplo n.º 29
0
 public function setUp()
 {
     parent::setUp();
     $this->edit_uri = 'http://someurl';
     $this->xref = 'some #xref';
     $this->title = 'do something interresting';
     $this->id = '234872';
     $epics_tracker_id = 123;
     $stories_tracker_id = 456;
     $this->allowed_children_types = array(aTracker()->withId($stories_tracker_id)->build());
     $this->epics_tracker = aTracker()->withId($epics_tracker_id)->build();
     $this->stories_tracker = aTracker()->withId($stories_tracker_id)->build();
     $this->planning = aPlanning()->withBacklogTrackerId($epics_tracker_id)->build();
     $this->epic = aMockArtifact()->withUri($this->edit_uri)->withXRef($this->xref)->withTitle($this->title)->withTracker($this->epics_tracker)->withAllowedChildrenTypes($this->allowed_children_types)->withId($this->id)->build();
     $this->story = aMockArtifact()->withTracker($this->stories_tracker)->build();
     $this->item = new Planning_Item($this->epic, $this->planning);
 }
 public function itAddsFileIntoArchive()
 {
     $tracker = aTracker()->build();
     $file_field = mock('Tracker_FormElement_Field_File');
     $file_info = stub('Tracker_FileInfo')->getPath()->returns($this->file01_path);
     stub($file_info)->getId()->returns(1);
     $files = array($file_info);
     $file_value = new Tracker_Artifact_ChangesetValue_File(1, $file_field, 1, $files);
     $changeset = stub('Tracker_Artifact_Changeset')->getValue($file_field)->returns($file_value);
     $artifact = stub('Tracker_Artifact')->getTracker()->returns($tracker);
     stub($artifact)->getLastChangeset()->returns($changeset);
     $form_element_factory = stub('Tracker_FormElementFactory')->getUsedFileFields($tracker)->returns(array($file_field));
     $exporter = new Tracker_XML_Exporter_ArtifactAttachmentExporter($form_element_factory);
     $exporter->exportAttachmentsInArchive($artifact, $this->archive);
     $this->extractArchive();
     $this->assertEqual(file_get_contents($this->extraction_path . '/data/Artifact1'), 'file01');
 }