public function setUp() { $artifact = aMockArtifact()->withId(123)->withTitle('Foo')->withXRef('milestone #123')->build(); $project = stub('Project')->getID()->returns(456); $this->milestone = aMilestone()->withArtifact($artifact)->withGroup($project)->withPlanningId(789)->build(); $this->presenter = new Planning_MilestoneLinkPresenter($this->milestone); }
public function setUp() { parent::setUp(); $this->artifact_id = 123; $this->artifact = anArtifact()->withId($this->artifact_id)->build(); $this->milestone = aMilestone()->withArtifact($this->artifact)->build(); $this->user = aUser()->build(); $this->project = mock('Project'); $this->milestone_factory = stub('Planning_MilestoneFactory')->getBareMilestoneByArtifactId($this->user, $this->artifact_id)->returns($this->milestone); }
public function setUp() { parent::setUp(); $this->planning_id = '321'; $this->user = aUser()->withId(12)->build(); $this->request = aRequest()->with('planning_id', $this->planning_id)->withUser($this->user)->build(); $this->milestone_factory = mock('Planning_MilestoneFactory'); $this->current_milestone_artifact_id = 444; $milestone = aMilestone()->withArtifact(anArtifact()->withId($this->current_milestone_artifact_id)->build())->build(); stub($this->milestone_factory)->getCurrentMilestone($this->user, $this->planning_id)->returns($milestone); }
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 itDisplaysASelectorOfArtifactWhenThereAreNoMilestoneSelected() { $current_milstone = new Planning_NoMilestone(mock('Project'), $this->sprint_planning); $milstone_1001 = aMilestone()->withArtifact(aMockArtifact()->withId(1001)->withTitle('An open artifact')->build())->build(); $milstone_1002 = aMilestone()->withArtifact(aMockArtifact()->withId(1002)->withTitle('Another open artifact')->build())->build(); stub($this->milestone_factory)->getAllBareMilestones($this->current_user, $this->sprint_planning)->returns(array($milstone_1001, $milstone_1002)); $this->pane_factory = new Planning_MilestonePaneFactory4Tests($this->request, $this->milestone_factory, $this->pane_presenter_builder_factory, mock('AgileDashboard_Milestone_Pane_Planning_SubmilestoneFinder'), mock('AgileDashboard_PaneInfoFactory')); $selectable_artifacts = $this->pane_factory->getAvailableMilestones($current_milstone); $this->assertCount($selectable_artifacts, 2); $this->assertEqual(array_shift($selectable_artifacts), $milstone_1001); $this->assertEqual(array_shift($selectable_artifacts), $milstone_1002); }
public function setUp() { parent::setUp(); ForgeConfig::store(); ForgeConfig::set('codendi_dir', AGILEDASHBOARD_BASE_DIR . '/../../..'); $this->planning_id = '321'; $this->user = aUser()->withId(12)->build(); $this->request = aRequest()->with('planning_id', $this->planning_id)->withUser($this->user)->build(); $this->milestone_factory = mock('Planning_MilestoneFactory'); $this->current_milestone_artifact_id = 444; $milestone = aMilestone()->withArtifact(anArtifact()->withId($this->current_milestone_artifact_id)->build())->build(); stub($this->milestone_factory)->getLastMilestoneCreated($this->user, $this->planning_id)->returns($milestone); }
public function setUp() { parent::setUp(); ForgeConfig::store(); ForgeConfig::set('codendi_dir', AGILEDASHBOARD_BASE_DIR . '/../../..'); $this->plugin_path = '/plugin/path'; $this->product = aMilestone()->withArtifact(aMockArtifact()->withId(1)->withTitle('Product X')->build())->build(); $this->release = aMilestone()->withArtifact(aMockArtifact()->withId(2)->withTitle('Release 1.0')->build())->build(); $this->sprint = aMilestone()->withArtifact(aMockArtifact()->withId(3)->withTitle('Sprint 1')->build())->build(); $this->nomilestone = stub('Planning_NoMilestone')->getPlanning()->returns(mock('Planning')); $this->milestone_factory = mock('Planning_MilestoneFactory'); $this->project_manager = mock('ProjectManager'); $this->current_user = aUser()->build(); $this->request = aRequest()->withUser($this->current_user)->with('group_id', 102)->build(); $this->project = mock('Project'); stub($this->project_manager)->getProject(102)->returns($this->project); }
public function setUp() { parent::setUp(); $this->dao = mock('AgileDashboard_BacklogItemDao'); $this->artifact_factory = mock('Tracker_ArtifactFactory'); $this->form_element_factory = mock('Tracker_FormElementFactory'); $this->milestone_factory = mock('Planning_MilestoneFactory'); $this->planning_factory = mock('PlanningFactory'); $this->backlog_item_builder = new AgileDashboard_Milestone_Backlog_BacklogItemBuilder(); $this->user = mock('PFUser'); $planning = mock('Planning'); stub($planning)->getBacklogTrackers()->returns(array(mock('Tracker'))); stub($planning)->getPlanningTracker()->returns(mock('Tracker')); $artifact = aMockArtifact()->build(); $this->milestone = aMilestone()->withArtifact($artifact)->withPlanning($planning)->build(); $this->factory = partial_mock('AgileDashboard_Milestone_Backlog_BacklogItemCollectionFactory', array('userCanReadBacklogTitleField', 'userCanReadBacklogStatusField', 'getInitialEffortField'), array($this->dao, $this->artifact_factory, $this->form_element_factory, $this->milestone_factory, $this->planning_factory, $this->backlog_item_builder)); stub($this->factory)->userCanReadBacklogTitleField()->returns(true); stub($this->factory)->userCanReadBacklogStatusField()->returns(true); $this->tracker1 = mock('Tracker'); $this->tracker2 = mock('Tracker'); $this->tracker3 = mock('Tracker'); $this->story1 = anArtifact()->userCanView($this->user)->withTitle('story 1')->withId($this->open_story_id)->withTracker($this->tracker1)->build(); $this->story2 = anArtifact()->userCanView($this->user)->withTitle('story 2')->withId($this->open_unplanned_story_id)->withTracker($this->tracker2)->build(); $this->story3 = anArtifact()->userCanView($this->user)->withTitle('story 3')->withId($this->closed_story_id)->withTracker($this->tracker3)->build(); $backlog_items = new AgileDashboard_Milestone_Backlog_DescendantItemsCollection(); $backlog_items->push($this->story1); $backlog_items->push($this->story2); $backlog_items->push($this->story3); $this->backlog_strategy = stub('AgileDashboard_Milestone_Backlog_BacklogStrategy')->getArtifacts($this->user)->returns($backlog_items); stub($this->backlog_strategy)->getMilestoneBacklogArtifactsTracker()->returns(mock('Tracker')); $this->redirect_to_self = 'whatever'; stub($this->dao)->getArtifactsSemantics()->returnsDar(array('id' => $this->open_story_id, Tracker_Semantic_Title::NAME => 'Story is open', Tracker_Semantic_Status::NAME => AgileDashboard_BacklogItemDao::STATUS_OPEN), array('id' => $this->open_unplanned_story_id, Tracker_Semantic_Title::NAME => 'Story is open and unplanned', Tracker_Semantic_Status::NAME => AgileDashboard_BacklogItemDao::STATUS_OPEN), array('id' => $this->closed_story_id, Tracker_Semantic_Title::NAME => 'Story is closed', Tracker_Semantic_Status::NAME => AgileDashboard_BacklogItemDao::STATUS_CLOSED)); $sub_milestone1 = stub('Planning_Milestone')->getArtifactId()->returns(121); $sub_milestone2 = stub('Planning_Milestone')->getArtifactId()->returns(436); stub($this->milestone_factory)->getSubMilestones()->returns(array($sub_milestone1, $sub_milestone2)); stub($this->artifact_factory)->getParents()->returns(array()); }
public function itDisplaysASelectorOfArtifactWhenThereAreNoMilestoneSelected() { $project = mock('Project'); $planning = mock('Planning'); $current_milstone = new Planning_NoMilestone($project, $planning); $milstone_1001 = aMilestone()->withArtifact(aMockArtifact()->withId(1001)->withTitle('An open artifact')->build())->build(); $milstone_1002 = aMilestone()->withArtifact(aMockArtifact()->withId(1002)->withTitle('Another open artifact')->build())->build(); stub($this->milestone_factory)->getMilestoneWithPlannedArtifactsAndSubMilestones()->returns($current_milstone); stub($this->milestone_factory)->getAllMilestones($this->current_user, $planning)->returns(array($milstone_1001, $milstone_1002)); $this->controller = new Planning_MilestoneControllerTrapPresenter($this->request, $this->milestone_factory, $this->project_manager); $selectable_artifacts = $this->getSelectableArtifacts(); $this->assertCount($selectable_artifacts, 2); $this->assertEqual(array_shift($selectable_artifacts), array('id' => 1001, 'title' => 'An open artifact', 'selected' => '')); $this->assertEqual(array_shift($selectable_artifacts), array('id' => 1002, 'title' => 'Another open artifact', 'selected' => '')); }
public function itCanBeAddedNewSubMilestones() { $sub_milestone_1 = aMilestone()->build(); $sub_milestone_2 = aMilestone()->withinTheSameProjectAs($sub_milestone_1)->build(); $sub_milestone_3 = aMilestone()->withinTheSameProjectAs($sub_milestone_1)->build(); $sub_milestone_4 = aMilestone()->withinTheSameProjectAs($sub_milestone_1)->build(); $this->milestone = aMilestone()->withinTheSameProjectAs($sub_milestone_1)->withSubMilestones(array($sub_milestone_1, $sub_milestone_2))->build(); $this->milestone->addSubMilestones(array($sub_milestone_3, $sub_milestone_4)); $this->assertIdentical($this->milestone->getSubMilestones(), array($sub_milestone_1, $sub_milestone_2, $sub_milestone_3, $sub_milestone_4)); }
public function setUp() { parent::setUp(); $this->current_user = aUser()->build(); $this->planning_factory = mock('PlanningFactory'); $this->artifact_factory = mock('Tracker_ArtifactFactory'); $this->milestone_factory = partial_mock('Planning_MilestoneFactory', array('getMilestoneFromArtifact'), array($this->planning_factory, $this->artifact_factory, mock('Tracker_FormElementFactory'))); $this->sprint_1_artifact = aMockArtifact()->withId(1)->build(); $this->sprint_1_milestone = aMilestone()->withArtifact($this->sprint_1_artifact)->build(); $this->planning_id = 12; $this->planning_tracker_id = 123; $this->planning_tracker = aTracker()->withId($this->planning_tracker_id)->withProject(mock('Project'))->build(); $this->planning = aPlanning()->withId($this->planning_id)->withPlanningTracker($this->planning_tracker)->build(); stub($this->planning_factory)->getPlanningWithTrackers($this->planning_id)->returns($this->planning); }
public function setUp() { parent::setUp(); $this->user = mock('PFUser'); $this->artifact = aMockArtifact()->withLinkedArtifacts(array(anArtifact()->withId(112)->build(), anArtifact()->withId(113)->build(), anArtifact()->withId(114)->build(), anArtifact()->withId(115)->build()))->build(); $this->milestone = aMilestone()->withArtifact($this->artifact)->build(); $this->milestone_resource_validator = partial_mock('Tuleap\\AgileDashboard\\REST\\v1\\MilestoneResourceValidator', array('validateArtifactsFromBodyContentWithClosedItems')); }