public function setUp() { parent::setUp(); /* Product Epic Release ----,-- Story Sprint ---' Task */ $this->user = aUser()->build(); $this->release_tracker_id = 101; $this->sprint_tracker_id = 1001; $this->task_tracker_project_id = 200; $this->epic_tracker = aTracker()->withId('epic')->withParent(null)->build(); $this->story_tracker = aTracker()->withId('story')->withParent($this->epic_tracker)->build(); $this->task_tracker = aTracker()->withId('task')->withProjectId($this->task_tracker_project_id)->withParent($this->story_tracker)->build(); $this->product_tracker = aTracker()->withId('product')->withParent(null)->build(); $this->release_tracker = aTracker()->withId($this->release_tracker_id)->withParent($this->product_tracker)->build(); $this->sprint_tracker = aTracker()->withId($this->sprint_tracker_id)->withParent($this->epic_tracker)->build(); $release_planning = stub('Planning')->getPlanningTracker()->returns($this->release_tracker); $sprint_planning = stub('Planning')->getPlanningTracker()->returns($this->sprint_tracker); $top_planning = stub('Planning')->getBacklogTrackersIds()->returns(array($this->release_tracker_id, $this->sprint_tracker_id)); $this->planning_factory = mock('PlanningFactory'); stub($this->planning_factory)->getPlanningByPlanningTracker($this->product_tracker)->returns(null); stub($this->planning_factory)->getPlanningByPlanningTracker($this->release_tracker)->returns($release_planning); stub($this->planning_factory)->getPlanningByPlanningTracker($this->sprint_tracker)->returns($sprint_planning); stub($this->planning_factory)->getVirtualTopPlanning($this->user, $this->task_tracker_project_id)->returns($top_planning); $this->hierarchy_factory = mock('Tracker_HierarchyFactory'); stub($this->hierarchy_factory)->getAllParents($this->sprint_tracker)->returns(array($this->release_tracker, $this->product_tracker)); $this->dao = mock('AgileDashboard_Milestone_MilestoneDao'); stub($this->dao)->getAllMilestoneByTrackers(array($this->release_tracker_id, $this->sprint_tracker_id))->returnsDar(array('m101_id' => '123', 'm101_title' => 'Tuleap 6.5', 'm1001_id' => '1231', 'm1001_title' => 'Sprint 31'), array('m101_id' => '123', 'm101_title' => 'Tuleap 6.5', 'm1001_id' => '1232', 'm1001_title' => 'Sprint 32'), array('m101_id' => '124', 'm101_title' => 'Tuleap 6.6', 'm1001_id' => '1241', 'm1001_title' => 'Sprint 33')); $this->nearest_planning_tracker_provider = mock('AgileDashboard_Planning_NearestPlanningTrackerProvider'); $this->provider = new AgileDashboard_Milestone_MilestoneReportCriterionOptionsProvider($this->nearest_planning_tracker_provider, $this->dao, $this->hierarchy_factory, $this->planning_factory); }
public function setUp() { parent::setUp(); $tracker_factory = mock('TrackerFactory'); $this->xml_importer = mock('Tracker_Artifact_XMLImport'); $this->artifact_factory = mock('Tracker_ArtifactFactory'); $this->children_collector = new Tracker_XML_ChildrenCollector(); $this->importer = new Tracker_XML_Importer_ChildrenXMLImporter($this->xml_importer, $tracker_factory, $this->artifact_factory, $this->children_collector); $this->artifacts_imported_mapping = mock('Tracker_XML_Importer_ArtifactImportedMapping'); $this->tracker = aTracker()->withId(23)->build(); stub($tracker_factory)->getTrackerById(23)->returns($this->tracker); $this->tracker_2 = aTracker()->withId(24)->build(); stub($tracker_factory)->getTrackerById(24)->returns($this->tracker_2); $this->user = aUser()->build(); $artlink_field = anArtifactLinkField()->withId($this->field_id)->build(); $artlink_field_2 = anArtifactLinkField()->withId($this->field_id_2)->build(); $root_artifact_id = 456; $this->root_artifact = mock('Tracker_Artifact'); stub($this->root_artifact)->getId()->returns($root_artifact_id); stub($this->root_artifact)->getAnArtifactLinkField($this->user)->returns($artlink_field); stub($this->artifact_factory)->getArtifactById($root_artifact_id)->returns($this->root_artifact); $this->created_artifact = mock('Tracker_Artifact'); stub($this->created_artifact)->getId()->returns(1023); stub($this->created_artifact)->getAnArtifactLinkField($this->user)->returns($artlink_field_2); stub($this->artifact_factory)->getArtifactById(1023)->returns($this->created_artifact); $this->another_child_artifact = anArtifact()->withId(1024)->build(); stub($this->artifact_factory)->getArtifactById(1024)->returns($this->another_child_artifact); }
public function setUp() { parent::setUp(); $this->milestone_1_id = 132; $this->milestone_1 = stub('Planning_ArtifactMilestone')->getArtifactId()->returns($this->milestone_1_id); $this->milestone_2_id = 853; $this->milestone_2 = stub('Planning_ArtifactMilestone')->getArtifactId()->returns($this->milestone_2_id); $this->virtual_top_milestone = stub('Planning_VirtualTopMilestone')->getArtifactId()->returns(null); $this->strategy_1 = mock('AgileDashboard_Milestone_Backlog_DescendantBacklogStrategy'); $this->strategy_2 = mock('AgileDashboard_Milestone_Backlog_DescendantBacklogStrategy'); $this->strategy_factory = mock('AgileDashboard_Milestone_Backlog_BacklogStrategyFactory'); stub($this->strategy_factory)->getBacklogStrategy($this->milestone_1)->returns($this->strategy_1); stub($this->strategy_factory)->getBacklogStrategy($this->milestone_2)->returns($this->strategy_2); $this->backlog_item_collection_factory = mock('AgileDashboard_Milestone_Backlog_BacklogItemCollectionFactory'); $this->sequence_id_manager = new AgileDashboard_SequenceIdManager($this->strategy_factory, $this->backlog_item_collection_factory); $this->user = aUser()->build(); $this->artifact_id_1 = 123; $this->artifact_id_2 = 456; $this->artifact_id_3 = 789; $this->artifact_1 = anArtifact()->withId($this->artifact_id_1)->build(); $this->artifact_2 = anArtifact()->withId($this->artifact_id_2)->build(); $this->artifact_3 = anArtifact()->withId($this->artifact_id_3)->build(); $this->artifact_id_4 = 254; $this->artifact_id_5 = 255; $this->artifact_id_6 = 256; $this->artifact_4 = anArtifact()->withId($this->artifact_id_4)->build(); $this->artifact_5 = anArtifact()->withId($this->artifact_id_5)->build(); $this->artifact_6 = anArtifact()->withId($this->artifact_id_6)->build(); $this->backlog_item_1 = stub('AgileDashboard_Milestone_Backlog_BacklogItem')->getArtifact()->returns($this->artifact_1); $this->backlog_item_2 = stub('AgileDashboard_Milestone_Backlog_BacklogItem')->getArtifact()->returns($this->artifact_2); $this->backlog_item_3 = stub('AgileDashboard_Milestone_Backlog_BacklogItem')->getArtifact()->returns($this->artifact_3); $this->items_collection = new AgileDashboard_Milestone_Backlog_BacklogItemCollection(); }
public function setUp() { $this->user = aUser()->build(); $this->tracker = mock('Tracker'); $summary_field = mock('Tracker_FormElement_Field_Text'); stub($summary_field)->getName()->returns('summary'); stub($summary_field)->userCanRead()->returns(true); $assigned_to_field = mock('Tracker_FormElement_Field_List'); stub($assigned_to_field)->getName()->returns('assigned_to'); stub($assigned_to_field)->userCanRead()->returns(true); $values_field = mock('Tracker_FormElement_Field_List'); stub($values_field)->getName()->returns('status'); stub($values_field)->userCanRead()->returns(true); $unreable_field = mock('Tracker_FormElement_Field_Text'); stub($unreable_field)->getName()->returns('whatever'); stub($unreable_field)->userCanRead()->returns(false); $unreable_field_list = mock('Tracker_FormElement_Field_List'); stub($unreable_field_list)->getName()->returns('whatever'); stub($unreable_field_list)->userCanRead()->returns(false); $this->semantic_title = new Tracker_Semantic_Title($this->tracker, $summary_field); $this->unreadable_semantic_title = new Tracker_Semantic_Title($this->tracker, $unreable_field); $this->semantic_contributor = new Tracker_Semantic_Contributor($this->tracker, $assigned_to_field); $this->unreadable_semantic_contributor = new Tracker_Semantic_Contributor($this->tracker, $unreable_field_list); $this->semantic_status = new Tracker_Semantic_Status($this->tracker, $values_field, $this->open_values); $this->unreadable_semantic_status = new Tracker_Semantic_Status($this->tracker, $unreable_field_list, $this->open_values); $this->semantic_tooltip = new Tracker_Tooltip($this->tracker); $this->not_defined_semantic_title = new Tracker_Semantic_Title($this->tracker); $this->not_defined_semantic_status = new Tracker_Semantic_Status($this->tracker); $this->not_defined_semantic_contributor = new Tracker_Semantic_Contributor($this->tracker); $this->semantic_manager = partial_mock('Tracker_SemanticManager', array('getSemantics', 'getSemanticOrder'), array($this->tracker)); stub($this->semantic_manager)->getSemanticOrder()->returns(array('title', 'status', 'contributor')); }
public function itCollectsUserById() { $user = aUser()->withId(101)->withLdapId('ldap_01')->withUserName('user_01')->build(); stub($this->user_manager)->getUserById(101)->returns($user); expect($this->collection)->add($user)->once(); $this->user_xml_exporter->exportUserByUserId(101, $this->base_xml, 'user'); }
private function GivenAnArtifact($tracker) { $artifact = TestHelper::getPartialMock('Tracker_Artifact', array('createNewChangeset', 'getUserManager')); $user_manager = stub('UserManager')->getCurrentUser()->returns(aUser()->withId(120)->build()); stub($artifact)->getUserManager()->returns($user_manager); $artifact->setTracker($tracker); return $artifact; }
public function itReturnsTheRESTValue() { $field = stub('Tracker_FormElement_Field_String')->getName()->returns('field_string'); $user = aUser()->withId(101)->build(); $changeset = new Tracker_Artifact_ChangesetValue_String(111, $field, true, 'myxedemic enthymematic', 'text'); $representation = $changeset->getRESTValue($user, $changeset); $this->assertEqual($representation->value, 'myxedemic enthymematic'); }
public function itExportsTheComments() { $user = aUser()->withId(101)->withLdapId('ldap_01')->withUserName('user_01')->build(); stub($this->user_manager)->getUserById(101)->returns($user); expect($this->values_exporter)->exportChangedFields($this->artifact_xml, '*', $this->artifact, $this->values)->once(); expect($this->comment)->exportToXML()->once(); $this->exporter->exportFullHistory($this->artifact_xml, $this->changeset); }
public function itReturnsTheRESTValue() { $field = stub('Tracker_FormElement_Field_Integer')->getName()->returns('field_int'); $user = aUser()->withId(101)->build(); $changeset = new Tracker_Artifact_ChangesetValue_Integer(111, $field, true, 556); $representation = $changeset->getRESTValue($user, $changeset); $this->assertEqual($representation->value, 556); }
public function setUp() { parent::setUp(); $this->key1 = 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxo4yIDI6bkSUVgXMZYmBZNDl3ttYUIxaThIX1hjp+Oxjo1yeI+vytb1UvESnu1fAhNB40KpPwL7md+UwfHyo2Jah9PMq6bfrSupAE6NOJQ4xG5W7hP70ih5UZtA9YuZfzDc7JsCpwlF7Fvhc+1u4uRYxuKQ+4SpzxCNkmMAMD9BzjXq0Jt/6MsEz+Txt6xoo+HAZXUnUq/XgqMh1A71zAjz6E1ADsd1vLYekQruy9uzhnq9Q7bi+evS1bvi7/O+csAqpIvN/stBqIzALpoAGY1Ek/YMKxjzNurnRTtwEuvqciaPk4aZGg5UvWL1B+yo7HuG/Je0KSz/+u+1efqLUxw== user@shunt'; $this->key2 = 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAo2Z2ru57hk2p9wMkM66IxYV1HFKEJvWjWi7Otug/G14LWwO1VU5wNBJgJEfaAoL7ccRpWYpRKLAZdAPYq8nOVFsTU0X4z4mtIo8L1mlw+qXZ3KW77/QJ7sNbCZe6vpNcKg0+DX0e4n0h6R+lXIwi/ISM6wXPQU3uUKVRbcykC9YwEnQokFXXHRqeBzPjyRFval4SRMHAdcs2pjZtu5Et0pObR+Lrs532NE1tvDUrPbU1Oy+9w7bbcvbfjKeYX7FgdXmlYDYLcAfZG4wCHBBYbp5HNXTxhwv4wHq7Z20tEN4qqBnehCGPOpBIgbfBTdN9NftloRYrVPNAxKXhPd/VRQ== user@crampons'; $this->user = aUser()->build(); $this->validator = new User_SSHKeyValidator(); }
public function setUp() { parent::setUp(); $user = aUser()->withId(101)->withLdapId('ldap_01')->withUserName('user_01')->build(); $this->changeset = aChangeset()->build(); $this->timestamp = '1433863107'; $this->user_manager = stub('UserManager')->getUserById(101)->returns($user); UserManager::setInstance($this->user_manager); }
public function setUp() { parent::setUp(); $this->backlog_dao = mock('AgileDashboard_BacklogItemDao'); $this->artifact_dao = mock('Tracker_ArtifactDao'); $this->artifact_factory = mock('Tracker_ArtifactFactory'); $this->user = aUser()->build(); $this->counter = new AgileDashboard_Milestone_MilestoneStatusCounter($this->backlog_dao, $this->artifact_dao, $this->artifact_factory); }
public function itExportsUserInXMLByItsId() { $user = aUser()->withId(101)->withLdapId('ldap_01')->withUserName('user_01')->build(); stub($this->user_manager)->getUserById(101)->returns($user); $this->user_xml_exporter->exportUserByUserId(101, $this->base_xml, 'user'); $this->assertEqual((string) $this->base_xml->user['format'], 'ldap'); $this->assertEqual((string) $this->base_xml->user, 'ldap_01'); }
public function setUp() { parent::setUp(); $this->tracker_id = 12; $this->tracker = aTracker()->withId($this->tracker_id)->build(); $this->user_id = 32; $this->user = aUser()->withId($this->user_id)->build(); $this->report_factory = partial_mock('Tracker_ReportFactory', array('getReportsByTrackerId')); }
public function setUp() { parent::setUp(); $this->task_tracker = aTracker()->withId('task')->build(); $this->options_provider = mock('AgileDashboard_Milestone_MilestoneReportCriterionOptionsProvider'); $this->milestone_id_provider = mock('AgileDashboard_Milestone_SelectedMilestoneProvider'); $this->user = aUser()->build(); $this->provider = new AgileDashboard_Milestone_MilestoneReportCriterionProvider($this->milestone_id_provider, $this->options_provider); }
public function setUp() { parent::setUp(); $this->trigger_rules_manager = mock('Tracker_Workflow_Trigger_RulesManager'); $this->field = anArtifactLinkField()->build(); $this->artifact = anArtifact()->build(); $this->user = aUser()->build(); $this->command = new Tracker_FormElement_Field_ArtifactLink_ProcessChildrenTriggersCommand($this->field, $this->trigger_rules_manager); }
public function _itReturnsCrossSearchViewIncludingTheContentView() { $user = aUser()->build(); $project = mock('Project'); $cross_search_query = mock('Tracker_CrossSearch_Query'); $view_builder = TestHelper::getPartialMock('Tracker_CrossSearch_ViewBuilder', array('buildContentView', 'getService')); $view_builder->expectOnce('buildContentView', array($user, $project, $cross_search_query)); $view_builder->build($user, $project, $cross_search_query); }
public function setUp() { parent::setUp(); $this->user = aUser()->withLdapId("testUser")->build(); $this->gerrit_driver_factory = mock('Git_Driver_Gerrit_GerritDriverFactory'); $this->remote_gerrit_factory = mock('Git_RemoteServer_GerritServerFactory'); $this->user_account_manager = new Git_UserAccountManager($this->gerrit_driver_factory, $this->remote_gerrit_factory); $this->gerrit_user_account_manager = mock('Git_Driver_Gerrit_UserAccountManager'); $this->user_account_manager->setGerritUserAccountManager($this->gerrit_user_account_manager); }
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->base_language = mock('BaseLanguage'); stub($this->base_language)->getText('plugin_tracker_artifact', 'changed_from')->returns('changed from'); stub($this->base_language)->getText('plugin_tracker_artifact', 'to')->returns('to'); $GLOBALS['Language'] = $this->base_language; $this->field = stub('Tracker_FormElement_Field_Date')->getName()->returns('field_date'); $this->user = aUser()->withId(101)->build(); }
public function itReturnsZeroWhenUserDoesntHavePermissions() { $user = aUser()->build(); $artifact_value = stub('Tracker_Artifact_ChangesetValue_Float')->getValue()->returns(123.45); $artifact = aMockArtifact()->withValue($artifact_value)->build(); $field = TestHelper::getPartialMock('Tracker_FormElement_Field_Float', array('userCanRead')); stub($field)->userCanRead($user)->returns(false); $actual_value = $field->getComputedValue($user, $artifact); $this->assertEqual(0, $actual_value); }
public function setUp() { parent::setUp(); ForgeConfig::store(); ForgeConfig::set('tuleap_dir', __DIR__ . '/../../../../../'); $this->a_user = aUser()->withId(101)->withUserName('kshen')->withRealName('Kool Shen')->withEmail('*****@*****.**')->withLdapId('cb9867')->build(); $this->another_user = aUser()->withId(102)->withUserName('jstar')->withRealName('Joeystarr <script>')->withEmail('*****@*****.**')->build(); $this->none = aUser()->withId(100)->build(); $this->collection = new UserXMLExportedCollection(new XML_RNGValidator(), new XML_SimpleXMLCDATAFactory()); }
public function setUp() { parent::setUp(); $this->my_user = aUser()->withId(101)->build(); $this->none_user = aUser()->withId(100)->build(); $this->collection = mock('User\\XML\\Import\\ReadyToBeImportedUsersCollection'); $this->user_manager = mock('UserManager'); stub($this->user_manager)->getUserAnonymous()->returns(anAnonymousUser()->build()); stub($this->user_manager)->getUserByUserName('None')->returns($this->none_user); $this->mapping = new Mapping($this->user_manager, $this->collection, mock('Logger')); }
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->current_user = aUser()->build(); $this->form_element_factory = mock('Tracker_FormElementFactory'); Tracker_FormElementFactory::setInstance($this->form_element_factory); $this->dao = mock('Tracker_Chart_Burndown_Data_LinkedArtifactsDao'); stub($this->dao)->searchRemainingEffort()->returns(array()); $this->burndown_data = TestHelper::getPartialMock('Tracker_Chart_Burndown_Data_LinkedArtifacts', array('getBurndownDao')); stub($this->burndown_data)->getBurndownDao()->returns($this->dao); }
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 setUp() { parent::setUp(); $this->card_in_cell_presenter_builder = mock('Cardwall_CardInCellPresenterBuilder'); $this->artifact_factory = mock('Tracker_ArtifactFactory'); $this->dao = mock('AgileDashboard_BacklogItemDao'); $this->swimline_factory = mock('Cardwall_SwimlineFactory'); $this->user = aUser()->build(); $this->milestone_artifact = anArtifact()->withId(1)->build(); $this->mapping_collection = mock('Cardwall_MappingCollection'); $this->columns = mock('Cardwall_OnTop_Config_ColumnCollection'); }
public function setUp() { parent::setUp(); $this->user_manager = mock('UserManager'); $this->token_dao = mock('Rest_TokenDao'); $this->token_factory = new Rest_TokenFactory($this->token_dao); $this->token_manager = new Rest_TokenManager($this->token_dao, $this->token_factory, $this->user_manager); $this->user_id = 'whatever'; $this->token_value = 'whateverSha1Token'; $this->token = new Rest_Token($this->user_id, $this->token_value); $this->user = aUser()->withId($this->user_id)->build(); }
public function setUp() { parent::setUp(); $this->user = aUser()->build(); $this->tracker = aTracker()->withId($this->current_id)->build(); $this->factory = mock('Tracker_FormElementFactory'); $this->changeset = mock('Tracker_Artifact_Changeset'); $this->artifact = anArtifact()->withId($this->current_id + 100)->withTracker($this->tracker)->withFormElementFactory($this->factory)->withChangesets(array($this->changeset))->build(); $hierarchy_factory = mock('Tracker_HierarchyFactory'); stub($hierarchy_factory)->getChildren()->returns(array()); $this->artifact->setHierarchyFactory($hierarchy_factory); }
public function setUp() { parent::setUp(); ForgeConfig::store(); $this->cache_dir = trim(`mktemp -d -p /var/tmp cache_dir_XXXXXX`); ForgeConfig::set('codendi_cache_dir', $this->cache_dir); $user = aUser()->withId(101)->build(); $dao = mock('Tracker_Artifact_Attachment_TemporaryFileManagerDao'); stub($dao)->create()->returns(1); $file_info_factory = mock('Tracker_FileInfoFactory'); $this->file_manager = new Tracker_Artifact_Attachment_TemporaryFileManager($user, $dao, $file_info_factory); }