Ejemplo n.º 1
0
 public function setUp()
 {
     parent::setUp();
     $this->project = stub('Project')->getID()->returns(123);
     $this->planning = aPlanning()->build();
     $this->artifact = aMockArtifact()->withTitle('Foo')->build();
     $this->milestone = new Planning_ArtifactMilestone($this->project, $this->planning, $this->artifact);
 }
Ejemplo n.º 2
0
 public function setUp()
 {
     parent::setUp();
     $this->group_id = 12;
     $this->release_planning_id = 34;
     $this->releases_tracker_id = 56;
     $this->sprints_tracker_id = 78;
     $this->holidays_tracker_id = 90;
     $this->release_planning = aPlanning()->withId($this->release_planning_id)->withPlanningTrackerId($this->releases_tracker_id)->build();
     stub($this->factory)->getPlanning($this->release_planning_id)->returns($this->release_planning);
     stub($this->factory)->getPlanningTrackerIdsByGroupId($this->group_id)->returns(array($this->releases_tracker_id, $this->sprints_tracker_id));
 }
 public function setUp()
 {
     parent::setUp();
     $planning_id = "99876387";
     $aid = -1;
     $this->planning_tracker_id = 66;
     $this->request = aRequest()->withUri("/plugins/agiledashboard/?group_id=104&action=show&planning_id={$planning_id}&aid={$aid}")->build();
     $this->planning = aPlanning()->withId($planning_id)->withPlanningTrackerId($this->planning_tracker_id)->build();
     $planning_factory = mock('PlanningFactory');
     stub($planning_factory)->getPlanning($planning_id)->returns($this->planning);
     $this->controller = new Planning_ArtifactCreationController($planning_factory, $this->request);
 }
Ejemplo n.º 4
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.º 5
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);
 }
Ejemplo n.º 6
0
 public function setUp()
 {
     parent::setUp();
     $this->backlog_tracker_id = 486;
     $this->backlog_tracker_ids = array($this->backlog_tracker_id, 123, 456);
     $this->backlog_actions_presenter = mock('Planning_BacklogActionsPresenter');
     $this->formElementFactory = mock('Tracker_FormElementFactory');
     $this->tracker_factory = mock('TrackerFactory');
     $this->search = mock('Tracker_CrossSearch_Search');
     $this->criteria_builder = mock('Tracker_CrossSearch_CriteriaBuilder');
     $this->tracker_factory->setReturnValue('getTrackersByGroupIdUserCanView', $this->backlog_tracker_id);
     $this->criteria_builder->setReturnValue('getCriteria', array());
     $this->user = aUser()->build();
     $this->project = mock('Project');
     $this->cross_search_criteria = aCrossSearchCriteria()->build();
     $this->builder = new Planning_ViewBuilder($this->formElementFactory, $this->search, $this->criteria_builder);
     $this->planning = aPlanning()->build();
 }
Ejemplo n.º 7
0
 public function setUp()
 {
     parent::setUp();
     $this->sprint_1 = mock('Planning_Milestone');
     stub($this->sprint_1)->getArtifactId()->returns(1);
     stub($this->sprint_1)->getArtifactTitle()->returns('Sprint 1');
     stub($this->sprint_1)->getPlanning()->returns(aPlanning()->build());
     stub($this->sprint_1)->getLinkedArtifacts()->returns(array());
     stub($this->sprint_1)->hasAncestors()->returns(true);
     $this->sprint_2 = aMilestone()->withArtifact(aMockArtifact()->withId(2)->withTitle('Sprint 2')->build())->build();
     $this->milestone_factory = mock('Planning_MilestoneFactory');
     $this->project_manager = stub('ProjectManager')->getProject()->returns(mock('Project'));
     $this->current_user = aUser()->build();
     $this->request = aRequest()->withUser($this->current_user)->build();
     Tracker_HierarchyFactory::setInstance(mock('Tracker_HierarchyFactory'));
 }
Ejemplo n.º 8
0
 public function itRendersTheEditTemplate()
 {
     $group_id = 123;
     $planning_id = 456;
     $planning = aPlanning()->withGroupId($group_id)->withId($planning_id)->build();
     $request = aRequest()->with('planning_id', $planning_id)->with('action', 'edit')->build();
     $planning_factory = mock('PlanningFactory');
     stub($planning_factory)->getPlanning($planning_id)->returns($planning);
     stub($planning_factory)->getAvailableBacklogTrackers('*', $group_id)->returns(array());
     stub($planning_factory)->getAvailablePlanningTrackers('*', $group_id)->returns(array());
     $kanban_factory = stub('AgileDashboard_KanbanFactory')->getKanbanTrackerIds()->returns(array());
     $controller = partial_mock('Planning_Controller', array('renderToString'), array($request, $planning_factory, mock('Planning_ShortAccessFactory'), mock('Planning_MilestoneFactory'), mock('ProjectManager'), mock('AgileDashboard_XMLFullStructureExporter'), '/path/to/theme', '/path/to/plugin', mock('AgileDashboard_KanbanManager'), mock('AgileDashboard_ConfigurationManager'), $kanban_factory, mock('PlanningPermissionsManager')));
     $controller->expectOnce('renderToString', array('edit', new IsAExpectation('Planning_FormPresenter')));
     $controller->edit();
 }
Ejemplo n.º 9
0
 public function itTranslatesUgroupsIdsFromUgroupsMapping()
 {
     $dao = new MockPlanningDao();
     $planning_permissions_manager = stub('PlanningPermissionsManager')->getGroupIdsWhoHasPermissionOnPlanning()->returns(array(4, 103, 104));
     $factory = partial_mock('PlanningFactory', array('getPlanning'), array($dao, mock('TrackerFactory'), mock('Tracker_FormElementFactory'), $planning_permissions_manager));
     $group_id = 123;
     $sprint_tracker_id = 1;
     $story_tracker_id = 2;
     $bug_tracker_id = 3;
     $faq_tracker_id = 4;
     $sprint_tracker_copy_id = 5;
     $story_tracker_copy_id = 6;
     $bug_tracker_copy_id = 7;
     $faq_tracker_copy_id = 8;
     stub($factory)->getPlanning(1)->returns(aPlanning()->withId(1)->withGroupId($group_id)->build());
     $tracker_mapping = array($sprint_tracker_id => $sprint_tracker_copy_id, $story_tracker_id => $story_tracker_copy_id, $bug_tracker_id => $bug_tracker_copy_id, $faq_tracker_id => $faq_tracker_copy_id);
     $sprint_planning_name = 'Sprint Planning';
     $rows = TestHelper::arrayToDar(array('id' => 1, 'name' => $sprint_planning_name, 'group_id' => 101, 'backlog_title' => 'Backlog', 'plan_title' => 'Plan', 'planning_tracker_id' => $sprint_tracker_id));
     stub($dao)->searchByPlanningTrackerIds(array_keys($tracker_mapping))->returns($rows);
     stub($dao)->searchBacklogTrackersById(1)->returnsDar(array('planning_id' => 1, 'tracker_id' => $story_tracker_id));
     stub($dao)->searchById(1)->returnsDar(array('id' => 1, 'name' => $sprint_planning_name, 'group_id' => 101, 'backlog_title' => 'Backlog', 'plan_title' => 'Plan', 'planning_tracker_id' => $sprint_tracker_copy_id, 'backlog_tracker_ids' => array($story_tracker_copy_id)));
     $expected_paramters = PlanningParameters::fromArray(array('id' => 1, 'name' => $sprint_planning_name, 'group_id' => 101, 'backlog_title' => 'Backlog', 'plan_title' => 'Plan', 'planning_tracker_id' => $sprint_tracker_copy_id, 'backlog_tracker_ids' => array($story_tracker_copy_id)));
     $expected_ugroups = array(4, 113, 114);
     expect($planning_permissions_manager)->savePlanningPermissionForUgroups('*', '*', PlanningPermissionsManager::PERM_PRIORITY_CHANGE, $expected_ugroups)->once();
     $ugroups_mapping = array(103 => 113, 104 => 114);
     $factory->duplicatePlannings($group_id, $tracker_mapping, $ugroups_mapping);
 }
Ejemplo n.º 10
0
 public function withPlanningId($planning_id)
 {
     $this->withPlanning(aPlanning()->withId($planning_id)->build());
     return $this;
 }
Ejemplo n.º 11
0
 public function itRetrievesAvailablePlanningTrackersIncludingTheCurrentPlanningTracker()
 {
     $group_id = 789;
     $planning_dao = mock('PlanningDao');
     $tracker_factory = mock('TrackerFactory');
     $planning_factory = aPlanningFactory()->withDao($planning_dao)->withTrackerFactory($tracker_factory)->build();
     $sprints_tracker_row = array('id' => 1, 'name' => 'Sprints');
     $stories_tracker_row = array('id' => 2, 'name' => 'Stories');
     $tracker_rows = array($sprints_tracker_row, $stories_tracker_row);
     $sprints_tracker = aTracker()->withId(1)->withName('Sprints')->build();
     $stories_tracker = aTracker()->withId(2)->withName('Stories')->build();
     $releases_tracker = aTracker()->withId(3)->withName('Releases')->build();
     stub($tracker_factory)->getInstanceFromRow($sprints_tracker_row)->returns($sprints_tracker);
     stub($tracker_factory)->getInstanceFromRow($stories_tracker_row)->returns($stories_tracker);
     stub($planning_dao)->searchNonPlanningTrackersByGroupId($group_id)->returns($tracker_rows);
     $planning = aPlanning()->withGroupId($group_id)->withPlanningTracker($releases_tracker)->build();
     $actual_trackers = $planning_factory->getAvailablePlanningTrackers($planning);
     $this->assertEqual(count($actual_trackers), 3);
     list($releases_tracker, $sprints_tracker, $stories_tracker) = $actual_trackers;
     $this->assertEqual($releases_tracker->getId(), 3);
     $this->assertEqual($sprints_tracker->getId(), 1);
     $this->assertEqual($stories_tracker->getId(), 2);
     $this->assertEqual($releases_tracker->getName(), 'Releases');
     $this->assertEqual($sprints_tracker->getName(), 'Sprints');
     $this->assertEqual($stories_tracker->getName(), 'Stories');
 }
Ejemplo n.º 12
0
 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);
 }
Ejemplo n.º 13
0
 public function setUp()
 {
     parent::setUp();
     $this->sprint_planning = aPlanning()->withBacklogTracker(aTracker()->build())->build();
     $this->sprint_1 = mock('Planning_Milestone');
     stub($this->sprint_1)->getArtifactId()->returns(1);
     stub($this->sprint_1)->getArtifactTitle()->returns('Sprint 1');
     stub($this->sprint_1)->getPlanning()->returns($this->sprint_planning);
     stub($this->sprint_1)->getLinkedArtifacts()->returns(array());
     stub($this->sprint_1)->hasAncestors()->returns(true);
     $this->sprint_2 = aMilestone()->withArtifact(aMockArtifact()->withId(2)->withTitle('Sprint 2')->build())->build();
     $this->milestone_factory = mock('Planning_MilestoneFactory');
     $this->project_manager = stub('ProjectManager')->getProject()->returns(mock('Project'));
     $this->current_user = aUser()->build();
     $this->request = aRequest()->withUser($this->current_user)->build();
     $this->view_builder = stub('Planning_ViewBuilder')->build()->returns(mock('Tracker_CrossSearch_SearchContentView'));
     $this->hierarchy_factory = mock('Tracker_HierarchyFactory');
     stub($this->hierarchy_factory)->getHierarchy()->returns(new Tracker_Hierarchy());
 }
Ejemplo n.º 14
0
 public function __only__itReturnsNullWhenUserCannotSeeArtifacts()
 {
     $planning_tracker = aTracker()->withId(12)->withProject(mock('Project'))->build();
     stub($this->planning_factory)->getPlanningByPlanningTracker()->returns(aPlanning()->withId(4)->build());
     $artifact = aMockArtifact()->build();
     stub($artifact)->userCanView($this->user)->returns(false);
     stub($this->artifact_factory)->getArtifactById($this->artifact_id)->returns($artifact);
     $this->assertNull($this->milestone_factory->getBareMilestoneByArtifactId($this->user, $this->artifact_id));
 }
Ejemplo n.º 15
0
 public function itRendersTheEditTemplate()
 {
     $group_id = 123;
     $planning_id = 456;
     $planning = aPlanning()->withGroupId($group_id)->withId($planning_id)->build();
     $request = aRequest()->with('planning_id', $planning_id)->with('action', 'edit')->build();
     $planning_factory = mock('PlanningFactory');
     $controller = new MockPlanning_Controller();
     stub($planning_factory)->getPlanningWithTrackers($planning_id)->returns($planning);
     stub($planning_factory)->getAvailableTrackers($group_id)->returns(array());
     stub($planning_factory)->getAvailablePlanningTrackers($planning)->returns(array());
     $controller->__construct($request, $planning_factory);
     $controller->expectOnce('render', array('edit', new IsAExpectation('Planning_FormPresenter')));
     $controller->edit();
 }