public function itCopiesAllPropertiesOfTheGivenNode()
 {
     $tree_node = aNode()->withId(3)->withArtifact(mock('Tracker_Artifact'))->withChildren(aNode(), aNode())->withObject(mock('Tracker_Artifact'))->build();
     $presenter_node = $this->newNode($tree_node);
     $this->assertEqual($tree_node->getId(), $presenter_node->getId());
     $this->assertIdentical($tree_node->getData(), $presenter_node->getData());
     $this->assertEqual($tree_node->getChildren(), $presenter_node->getChildren());
     $this->assertEqual($tree_node->getObject(), $presenter_node->getObject());
 }
 public function itCopiesAllTreeNodesIntoCardPresenterNodes()
 {
     $root_node = aNode()->withChildren(aNode()->withObject(anArtifact()->withTracker(mock('Tracker'))->withoutParent()->build()), aNode()->withObject(anArtifact()->withTracker(mock('Tracker'))->withoutParent()->build()))->build();
     $card_mapper = new TreeNodeMapper(new Planning_ItemCardPresenterCallback(mock('Planning'), mock('Tracker_CardFields'), mock('User'), 'whatever-class'));
     $visited_node = $card_mapper->map($root_node);
     $all_nodes = $visited_node->flattenChildren();
     $this->assertEqual(count($all_nodes), count($root_node->flattenChildren()));
     foreach ($all_nodes as $node) {
         $this->assertIsA($node, 'Tracker_TreeNode_CardPresenterNode');
     }
 }
 public function setUp()
 {
     parent::setUp();
     $this->field_id = 77777;
     $this->field = stub('Tracker_FormElement_Field_MultiselectBox')->getId()->returns($this->field_id);
     $this->artifact = mock('Tracker_Artifact');
     $this->node = aNode()->withId(4444)->build();
     $this->card_presenter = stub('Cardwall_CardPresenter')->getArtifact()->returns($this->artifact);
     $this->card_presenter_node = new Tracker_TreeNode_CardPresenterNode($this->node, $this->card_presenter);
     $this->field_retriever = stub('Cardwall_FieldProviders_IProvideFieldGivenAnArtifact')->getField($this->artifact)->returns($this->field);
     $this->callback = new Cardwall_CardInCellPresenterCallback($this->field_retriever, new Cardwall_MappingCollection());
 }
Exemple #4
0
 public function itGetsTheLinkedArtifactsOfChildNodes()
 {
     $root_artifact = aMockArtifact()->withId(9999)->withTitle('root artifact')->build();
     $linked_artifact_1 = aMockArtifact()->build();
     $linked_artifact_2 = aMockArtifact()->build();
     $artifact = aMockArtifact()->withId(1111)->withUniqueLinkedArtifacts(array($linked_artifact_1, $linked_artifact_2))->build();
     $planned_artifacts = aNode()->withObject($root_artifact)->withChild(aNode()->withObject($artifact))->build();
     $milestone = new Planning_ArtifactMilestone($this->project, mock('Planning'), $root_artifact, $planned_artifacts);
     $all_artifacts = $milestone->getLinkedArtifacts(mock('User'));
     $this->assertEqual(count($all_artifacts), 3);
 }
 public function setUp()
 {
     parent::setUp();
     '┝ corporation    ──────≫ theme
      │ ┝ product      ──┬───≫  ┕ epic
      │ │  ┕ release   ──┘   ┌─≫   ┕ story
      │ │     ┕ sprint ──────┘
      │ ┕ product2
      │    ┕ release2
      ┕ faq
     ';
     $this->corp_tracker = aTracker()->build();
     $this->product_tracker = aTracker()->build();
     $this->release_tracker = aTracker()->build();
     $this->sprint_tracker = aTracker()->build();
     $this->epic_tracker = aTracker()->build();
     $this->theme_tracker = aTracker()->build();
     $this->faq_tracker = aTracker()->build();
     $this->story_tracker = aTracker()->build();
     $hierarchy_factory = mock('Tracker_HierarchyFactory');
     stub($hierarchy_factory)->getParent($this->product_tracker)->returns($this->corp_tracker);
     stub($hierarchy_factory)->getParent($this->release_tracker)->returns($this->product_tracker);
     stub($hierarchy_factory)->getParent($this->sprint_tracker)->returns($this->release_tracker);
     stub($hierarchy_factory)->getParent($this->epic_tracker)->returns($this->theme_tracker);
     stub($hierarchy_factory)->getParent($this->story_tracker)->returns($this->epic_tracker);
     $corp_planning = stub('Planning')->getBacklogTrackers()->returns(array($this->theme_tracker));
     $product_planning = stub('Planning')->getBacklogTrackers()->returns(array($this->epic_tracker));
     $release_planning = stub('Planning')->getBacklogTrackers()->returns(array($this->epic_tracker));
     $sprint_planning = stub('Planning')->getBacklogTrackers()->returns(array($this->story_tracker));
     $planning_factory = mock('PlanningFactory');
     stub($planning_factory)->getPlanningByPlanningTracker($this->corp_tracker)->returns($corp_planning);
     stub($planning_factory)->getPlanningByPlanningTracker($this->product_tracker)->returns($product_planning);
     stub($planning_factory)->getPlanningByPlanningTracker($this->release_tracker)->returns($release_planning);
     stub($planning_factory)->getPlanningByPlanningTracker($this->sprint_tracker)->returns($sprint_planning);
     $this->user = aUser()->build();
     $this->artifact_factory = mock('Tracker_ArtifactFactory');
     $this->milestone_factory = mock('Planning_MilestoneFactory');
     list($this->faq, $this->faq_milestone) = $this->getArtifact($this->faq_id, $this->faq_tracker, array());
     list($this->corp, $this->corp_milestone) = $this->getArtifact($this->corp_id, $this->corp_tracker, array());
     list($this->product, $this->product_milestone) = $this->getArtifact($this->product_id, $this->product_tracker, array($this->corp));
     list($this->product2, $this->product2_milestone) = $this->getArtifact($this->product2_id, $this->product_tracker, array($this->corp));
     list($this->release, $this->release_milestone) = $this->getArtifact($this->release_id, $this->release_tracker, array($this->product, $this->corp));
     list($this->release2, $this->release2_milestone) = $this->getArtifact($this->release2_id, $this->release_tracker, array($this->product2, $this->corp));
     list($this->sprint, $this->sprint_milestone) = $this->getArtifact($this->sprint_id, $this->sprint_tracker, array($this->release, $this->product, $this->corp));
     list($this->theme, $this->theme_milestone) = $this->getArtifact($this->theme_id, $this->theme_tracker, array());
     list($this->theme2, $this->theme2_milestone) = $this->getArtifact($this->theme2_id, $this->theme_tracker, array());
     list($this->epic, $this->epic_milestone) = $this->getArtifact($this->epic_id, $this->epic_tracker, array($this->theme));
     list($this->epic2, $this->epic2_milestone) = $this->getArtifact($this->epic2_id, $this->epic_tracker, array($this->theme));
     stub($this->corp_milestone)->getPlannedArtifacts()->returns(aNode()->withChildren(aNode()->withObject($this->product), aNode()->withObject($this->product2), aNode()->withObject($this->theme), aNode()->withObject($this->theme2))->build());
     $this->themes_associated_to_corp = array($this->theme, $this->theme2);
     $this->subreleases_of_corp = array($this->release, $this->release2);
     stub($this->release_milestone)->getPlannedArtifacts()->returns(aNode()->withChildren(aNode()->withObject($this->sprint), aNode()->withObject($this->epic), aNode()->withObject($this->epic2))->build());
     $this->epics_associated_to_release = array($this->epic, $this->epic2);
     stub($this->corp)->getLinkedArtifactsOfHierarchy()->returns(array($this->product, $this->product2));
     stub($this->product)->getLinkedArtifactsOfHierarchy()->returns(array($this->release));
     stub($this->product2)->getLinkedArtifactsOfHierarchy()->returns(array($this->release2));
     stub($this->release)->getLinkedArtifactsOfHierarchy()->returns(array($this->sprint));
     stub($this->release2)->getLinkedArtifactsOfHierarchy()->returns(array());
     stub($this->theme)->getLinkedArtifactsOfHierarchy()->returns(array($this->epic, $this->epic2));
     stub($this->theme2)->getLinkedArtifactsOfHierarchy()->returns(array());
     $this->selector = new Planning_ArtifactParentsSelector($this->artifact_factory, $planning_factory, $this->milestone_factory, $hierarchy_factory);
 }