/** * Build a Cardwall_Board taking account of Mapped Fieds * * @param PFUser $user * @param Tracker_ArtifactFactory $artifact_factory * @param Planning_Milestone $milestone * @param Cardwall_OnTop_Config $config * @param Cardwall_OnTop_Config_ColumnCollection $columns * * @return Cardwall_Board */ public function buildBoardUsingMappedFields(PFUser $user, Tracker_ArtifactFactory $artifact_factory, Planning_Milestone $milestone, Cardwall_OnTop_Config $config, Cardwall_OnTop_Config_ColumnCollection $columns) { $planning = $milestone->getPlanning(); $field_provider = new Cardwall_OnTop_Config_MappedFieldProvider($config, new Cardwall_FieldProviders_SemanticStatusFieldRetriever()); $column_preferences = new Cardwall_UserPreferences_Autostack_AutostackDashboard($user, $config->getTracker()); $column_autostack = new Cardwall_UserPreferences_UserPreferencesAutostackFactory(); $column_autostack->setAutostack($columns, $column_preferences); $mapping_collection = $this->getMappingCollection($planning, $columns, $field_provider, $config); $presenter_builder = new Cardwall_CardInCellPresenterBuilder(new Cardwall_CardInCellPresenterFactory($field_provider, $mapping_collection), new Cardwall_CardFields(UserManager::instance(), Tracker_FormElementFactory::instance()), $this->getDisplayPreferences($milestone, $user), $user); $swimline_factory = new Cardwall_SwimlineFactory($config, $field_provider); $pane_board_builder = new Cardwall_PaneBoardBuilder($presenter_builder, $artifact_factory, new AgileDashboard_BacklogItemDao(), $swimline_factory); $board = $pane_board_builder->getBoard($user, $milestone->getArtifact(), $columns, $mapping_collection); return $board; }
public function itReturnsABoardWithaSwimline() { $child_artifact = aMockArtifact()->withId('child')->allUsersCanView()->build(); $swimline_artifact = aMockArtifact()->withId('whatever')->allUsersCanView()->build(); stub($swimline_artifact)->getChildrenForUser()->returns(array($child_artifact)); stub($this->swimline_factory)->getCells()->returns(array()); $row = array('id' => 'whatever'); stub($this->artifact_factory)->getInstanceFromRow($row)->returns($swimline_artifact); stub($this->dao)->getBacklogArtifacts()->returnsDar($row); stub($this->card_in_cell_presenter_builder)->getCardInCellPresenter()->returns(mock('Cardwall_CardInCellPresenter')); stub($this->card_in_cell_presenter_builder)->getCardInCellPresenters()->returns(array(mock('Cardwall_CardInCellPresenter'))); $pane_builder = new Cardwall_PaneBoardBuilder($this->card_in_cell_presenter_builder, $this->artifact_factory, $this->dao, $this->swimline_factory); $board = $pane_builder->getBoard($this->user, $this->milestone_artifact, $this->columns, $this->mapping_collection); $this->assertCount($board->swimlines, 1); $this->assertIsA($board->swimlines[0], 'Cardwall_Swimline'); }