private function getTopMilestones(PFUser $user, Project $project) { $top_milestones = array(); $milestones = $this->milestone_factory->getSubMilestones($user, $this->milestone_factory->getVirtualTopMilestone($user, $project)); foreach ($milestones as $milestone) { $top_milestones[] = $milestone; } return $top_milestones; }
private function getSubmilestoneCollection(PFUser $user, Planning_ArtifactMilestone $milestone, Tracker $submilestone_tracker, $redirect_to_self) { $submilestones = array_reverse($this->milestone_factory->getSubMilestones($user, $milestone)); $submilestone_collection = new AgileDashboard_Milestone_Pane_Planning_PlanningSubMilestonePresenterCollection($submilestone_tracker); foreach ($submilestones as $submilestone) { $presenter = $this->submilestone_presenter_factory->getPlanningSubMilestonePresenter($user, $submilestone, $redirect_to_self); $submilestone_collection->push($presenter); } return $submilestone_collection; }
public function itSkipsArtifactsWithoutChangeset() { // Some artifacts have no changeset on Tuleap.net (because of anonymous that can create // artifacts but artifact creation fails because they have to write access to fields // the artifact creation is stopped half the way hence without changeset $artifact_1 = stub('Tracker_Artifact')->getLastChangeset()->returns(null); stub($artifact_1)->getTracker()->returns($this->tracker); $artifact_2 = stub('Tracker_Artifact')->getLastChangeset()->returns(mock('Tracker_Artifact_Changeset')); stub($artifact_2)->userCanView()->returns(true); stub($artifact_2)->getTracker()->returns($this->tracker); stub($artifact_2)->getAllAncestors()->returns(array()); $my_artifacts = array($artifact_1, $artifact_2); stub($this->artifact_factory)->getArtifactsByTrackerId()->returns($my_artifacts); stub($this->planning_factory)->getRootPlanning()->returns(mock('Planning')); $milestones = $this->milestone_factory->getSubMilestones($this->user, $this->top_milestone); $this->assertCount($milestones, 1); $milestone_1 = $milestones[0]; $this->assertEqual($milestone_1->getArtifact(), $artifact_2); }
private function getSubmilestoneIds(PFUser $user, Planning_Milestone $milestone) { $sub_milestones = $this->milestone_factory->getSubMilestones($user, $milestone); return array_map(array($this, 'extractArtifactId'), $sub_milestones); }