Exemplo n.º 1
0
 public function itLinksWithAllHierarchyWhenItWasLinkedToAnAssociatedTracker()
 {
     $user = aUser()->build();
     $epic_id = 2;
     $epic = aMockArtifact()->withId(2)->build();
     stub($epic)->getAllAncestors($user)->returns(array());
     $product = aMockArtifact()->withId(56)->build();
     $release_id = 7777;
     $release = aMockArtifact()->withId($release_id)->build();
     stub($release)->getAllAncestors($user)->returns(array($product));
     $request = aRequest()->with('link-artifact-id', "{$release_id}")->withUser($user)->build();
     $epic->expectNever('linkArtifact');
     $release->expectNever('linkArtifact');
     $product->expectOnce('linkArtifact', array($epic_id, $user));
     $artifact_factory = mock('Tracker_ArtifactFactory');
     stub($artifact_factory)->getArtifactById($release_id)->returns($release);
     $linker = new Planning_ArtifactLinker($artifact_factory);
     $linker->linkWithParents($request, $epic);
 }
Exemplo n.º 2
0
 /**
  * On create, the artifact was linked to it's immediate parent.
  * In agiledashoard, to remain consistent, it means that we need to link to all
  * parents
  *
  * @param array $params
  */
 private function updateBacklogs(array $params)
 {
     require_once 'Planning/ArtifactLinker.class.php';
     $artifact_linker = new Planning_ArtifactLinker(Tracker_ArtifactFactory::instance());
     $artifact_linker->linkWithParents($params['request'], $params['artifact']);
 }
 public function tracker_event_redirect_after_artifact_creation_or_update($params)
 {
     $params_extractor = new AgileDashboard_PaneRedirectionExtractor();
     $artifact_linker = new Planning_ArtifactLinker($this->getArtifactFactory(), PlanningFactory::build());
     $last_milestone_artifact = $artifact_linker->linkBacklogWithPlanningItems($params['request'], $params['artifact']);
     $requested_planning = $params_extractor->extractParametersFromRequest($params['request']);
     if ($requested_planning) {
         $this->redirectOrAppend($params['request'], $params['artifact'], $params['redirect'], $requested_planning, $last_milestone_artifact);
     }
 }