function testStoreEventsDoNotOverrideUsers()
 {
     $listeningUsers = new ArrayIterator(array(array('user_id' => 1, 'object_id' => 1), array('user_id' => 2, 'object_id' => 1), array('user_id' => 3, 'object_id' => 1)));
     $user1 = mock('PFUser');
     $user1->setReturnValue('getId', 1);
     $user2 = mock('PFUser');
     $user2->setReturnValue('getId', 2);
     $user3 = mock('PFUser');
     $user3->setReturnValue('getId', 3);
     $um = new MockUserManager();
     $um->setReturnValueAt(0, 'getUserById', $user1);
     $um->setReturnValueAt(1, 'getUserById', $user2);
     $um->setReturnValueAt(2, 'getUserById', $user3);
     $dpm = new MockDocman_PermissionsManager();
     $dpm->setReturnValue('userCanRead', true);
     $dpm->setReturnValue('userCanAccess', true);
     $item = new MockDocman_Item();
     $item->setReturnValue('getId', 1);
     $params = array('item' => $item);
     $nm = new Docman_NotificationsManager_DeleteTestVersion();
     $nm->setReturnValue('_getListeningUsers', $listeningUsers);
     $nm->setReturnValue('_getUserManager', $um);
     $nm->setReturnValue('_getPermissionsManager', $dpm);
     $nm->_listeners = array();
     $nm->_storeEvents(1, 'removed', $params);
     $this->assertEqual($user1, $nm->_listeners[1]['user']);
     $this->assertEqual($user2, $nm->_listeners[2]['user']);
     $this->assertEqual($user3, $nm->_listeners[3]['user']);
 }
 public function aSystemEventWithParameter($parameters)
 {
     $id = $type = $owner = $priority = $status = $create_date = $process_date = $end_date = $log = null;
     $event = new SystemEvent_FULLTEXTSEARCH_TRACKER_REINDEX_PROJECT($id, $type, $owner, $parameters, $priority, $status, $create_date, $process_date, $end_date, $log);
     $event->injectDependencies($this->actions, mock('TrackerFactory'), mock('FullTextSearch_TrackerSystemEventManager'), mock('TruncateLevelLogger'));
     return $event;
 }
 public function setUp()
 {
     parent::setUp();
     $this->target_tracker = aTracker()->withId(12)->withChildren(array())->build();
     $this->formelement_factory = mock('Tracker_FormElementFactory');
     $this->factory = new Tracker_Workflow_Trigger_RulesBuilderFactory($this->formelement_factory);
 }
 public function setUp()
 {
     parent::setUp();
     $this->dao = mock('Git_Driver_Gerrit_ProjectCreatorStatusDao');
     $this->repository = mock('GitRepository');
     $this->gerrit_status = new Git_Driver_Gerrit_ProjectCreatorStatus($this->dao);
 }
Esempio n. 5
0
 public function setUp()
 {
     parent::setUp();
     $this->ldap = mock('LDAP');
     stub($this->ldap)->getLDAPParam('dn')->returns('dc=tuleap,dc=com');
     $this->apache = new LDAP_SVN_Apache($this->ldap, mock('LDAP_ProjectManager'), array());
 }
 public function setUp()
 {
     $this->field_122 = aSelectBoxField()->withId(122)->build();
     $this->field_123 = aSelectBoxField()->withId(123)->build();
     $this->field_124 = aSelectBoxField()->withId(124)->build();
     $this->status_field = aSelectBoxField()->withId(125)->build();
     $group_id = 234;
     $this->tracker = aMockTracker()->withId(3)->withProjectId($group_id)->build();
     $this->tracker_10 = aMockTracker()->withId(10)->withStatusField($this->status_field)->build();
     $this->tracker_20 = aMockTracker()->withId(20)->build();
     $project_trackers = array(3 => $this->tracker, 10 => $this->tracker_10, 20 => $this->tracker_20);
     $tracker_factory = stub('TrackerFactory')->getTrackersByGroupId($group_id)->returns($project_trackers);
     foreach ($project_trackers as $t) {
         stub($tracker_factory)->getTrackerById($t->getId())->returns($t);
     }
     $element_factory = mock('Tracker_FormElementFactory');
     stub($element_factory)->getFieldById(123)->returns($this->field_123);
     stub($element_factory)->getFieldById(124)->returns($this->field_124);
     stub($element_factory)->getUsedSbFields($this->tracker_10)->returns(array($this->field_122, $this->field_123));
     stub($element_factory)->getUsedSbFields()->returns(array());
     $this->dao = mock('Cardwall_OnTop_ColumnMappingFieldDao');
     $this->value_mapping_factory = mock('Cardwall_OnTop_Config_ValueMappingFactory');
     stub($this->value_mapping_factory)->getMappings()->returns(array());
     stub($this->value_mapping_factory)->getStatusMappings()->returns(array());
     $this->columns = new Cardwall_OnTop_Config_ColumnFreestyleCollection(array(new Cardwall_Column(1, 'Todo', 'white', 'black'), new Cardwall_Column(2, 'On Going', 'white', 'black'), new Cardwall_Column(3, 'Done', 'white', 'black')));
     $this->factory = new Cardwall_OnTop_Config_TrackerMappingFactory($tracker_factory, $element_factory, $this->dao, $this->value_mapping_factory);
 }
 public function testRemoveMailByProjectPrivateRepositoryErrorDaoRemoving()
 {
     $prm = new PostReceiveMailManagerTestVersion();
     $user = mock('PFUser');
     $user->setReturnValue('isMember', False);
     $user->setReturnValue('getEmail', "*****@*****.**");
     $prj = new MockProject($this);
     $prj->setReturnValue('getId', 1750);
     $repositoryList = array(array('project_id' => '1750', 'repository_id' => 2515));
     $gitDao = new MockGitDao($this);
     $prm->setReturnValue('_getGitDao', $gitDao);
     $gitDao->setReturnValue('getProjectRepositoryList', $repositoryList);
     foreach ($repositoryList as $row) {
         $repo = new MockGitRepository($this);
         $prm->setReturnValue('_getGitRepository', $repo);
         $repo->setReturnValue('isPrivate', True);
         $repo->setReturnValue('load', True);
         $backend = new MockGitBackend();
         $repo->SetReturnValue('getBackend', $backend);
     }
     $prm->setReturnValue('removeMailByRepository', False);
     $GLOBALS['Language']->setReturnValue('getText', 'Mail not removed');
     $GLOBALS['Response']->expectOnce('addFeedback', array('error', $GLOBALS['Language']->getText('plugin_git', 'dao_error_remove_notification')));
     $prm->removeMailByProjectPrivateRepository($prj->getId(), $user);
 }
 public function setUp()
 {
     parent::setUp();
     $this->bind = partial_mock('Tracker_FormElement_Field_List_Bind4Tests', array('getAllValues'));
     $this->v1 = mock('Tracker_FormElement_Field_List_BindValue');
     $this->v2 = mock('Tracker_FormElement_Field_List_BindValue');
 }
Esempio n. 9
0
 public function itMayWrapAnObject()
 {
     $object = mock('stdClass');
     $node = new TreeNode();
     $node->setObject($object);
     $this->assertEqual($object, $node->getObject());
 }
 public function setUp()
 {
     /*
                    Epic
     Release  ----,-- Story
       Sprint ---'      Task
     */
     $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')->withParent($this->story_tracker)->build();
     $this->release_tracker = aTracker()->withId('release')->withParent(null)->build();
     $this->sprint_tracker = aTracker()->withId('sprint')->withParent($this->epic_tracker)->build();
     $release_planning = stub('Planning')->getPlanningTracker()->returns($this->release_tracker);
     stub($release_planning)->getPlanningTrackerId()->returns('release');
     $sprint_planning = stub('Planning')->getPlanningTracker()->returns($this->sprint_tracker);
     stub($sprint_planning)->getPlanningTrackerId()->returns('sprint');
     $this->hierarchy = mock('Tracker_Hierarchy');
     stub($this->hierarchy)->sortTrackerIds()->returns(array('release', 'sprint'));
     $this->hierarchy_factory = mock('Tracker_HierarchyFactory');
     stub($this->hierarchy_factory)->getHierarchy()->returns($this->hierarchy);
     $this->planning_factory = mock('PlanningFactory');
     stub($this->planning_factory)->getPlanningsByBacklogTracker($this->task_tracker)->returns(array());
     stub($this->planning_factory)->getPlanningsByBacklogTracker($this->story_tracker)->returns(array($sprint_planning, $release_planning));
     stub($this->planning_factory)->getPlanningsByBacklogTracker($this->epic_tracker)->returns(array());
     $this->provider = new AgileDashboard_Planning_NearestPlanningTrackerProvider($this->planning_factory);
 }
Esempio n. 11
0
 public function setUp()
 {
     parent::setUp();
     ForgeConfig::store();
     ForgeConfig::set('sys_logger_level', 'debug');
     $this->ldap = partial_mock('LDAP', array('search'), array($this->ldap_params, mock('TruncateLevelLogger'), new LdapQueryEscaper()));
 }
 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);
 }
Esempio n. 13
0
 public function setUp()
 {
     parent::setUp();
     $this->user_manager = mock('UserManager');
     $this->logger = mock('Logger');
     $this->user = new WillBeCreatedUser('cstevens', 'Cat Stevens', '*****@*****.**', 'S');
 }
 function setUp()
 {
     $this->user = mock('PFUser');
     $this->user->setReturnValue('getId', 1234);
     $this->itemId = 1848;
     $this->docmanPm = new Docman_PermissionsManagerTestLock($this);
 }
 public function testDiff()
 {
     $this->field = mock('Tracker_FormElement_Field_Integer');
     $int_1 = new Tracker_Artifact_ChangesetValue_Integer(111, $this->field, false, 66);
     $int_2 = new Tracker_Artifact_ChangesetValue_Integer(111, $this->field, false, 666);
     $this->assertEqual($int_1->diff($int_2), 'changed from 666 to 66');
 }
 public function setUp()
 {
     $this->template = array('name' => 'template-name', 'id' => 120);
     $this->project = mock('Project');
     stub($this->project)->getGroupId()->returns(101);
     stub($this->project)->getUnixName()->returns('h1tst');
 }
Esempio n. 17
0
 public function withFieldForTracker($field, $tracker)
 {
     $semantic = mock('Tracker_Semantic_Title');
     stub($semantic)->getField()->returns($field);
     stub($this->factory)->getByTracker($tracker)->returns($semantic);
     return $this;
 }
Esempio n. 18
0
 public function setUp()
 {
     parent::setUp();
     $this->factory = mock('PlanningFactory');
     $this->kanban_factory = mock('AgileDashboard_KanbanFactory');
     $this->validator = new Planning_RequestValidator($this->factory, $this->kanban_factory);
 }
Esempio n. 19
0
 public function setUp()
 {
     parent::setUp();
     $this->dao = mock('Openid_Dao');
     $this->driver = mock('Openid_Driver_ConnexionDriver');
     $this->connexion_manager = new Openid_ConnexionManager($this->driver);
 }
Esempio n. 20
0
 public function itExecutesTheNextCommand()
 {
     $next = mock('Git_GitoliteHousekeeping_ChainOfResponsibility_Command');
     expect($next)->execute()->once();
     $this->command->setNextCommand($next);
     $this->command->execute();
 }
 public function __construct($name = 'Changeset Value Open List Test')
 {
     parent::__construct($name);
     $this->field_class = 'MockTracker_FormElement_Field_OpenList';
     $this->changesetvalue_class = 'Tracker_Artifact_ChangesetValue_OpenList';
     $this->user = mock('PFUser');
 }
Esempio n. 22
0
 public function withValueForChangesetId($value_id, $changeset_id)
 {
     $bind = mock('Tracker_FormElement_Field_List_Bind_Static');
     stub($this->field)->getBind()->returns($bind);
     stub($bind)->getChangesetValues($changeset_id)->returns(array(array('id' => $value_id)));
     return $this;
 }
 protected function aOneStepProjectCreationForm($request_data)
 {
     $project_manager = mock('ProjectManager');
     $request = aRequest()->withParams($request_data)->build();
     $creation_request = new Project_OneStepCreation_OneStepCreationRequest($request, $project_manager);
     return new Project_OneStepCreation_OneStepCreationPresenter($creation_request, array(), $project_manager, array());
 }
 public function itCallsTheArtifactLinkExporterAccordinglyToTheTypeOfTheChangesetValue()
 {
     expect($this->int_exporter)->export()->never();
     expect($this->float_exporter)->export()->never();
     expect($this->artlink_exporter)->export()->once();
     $this->visitor->export($this->artifact_xml, $this->changeset_xml, mock('Tracker_Artifact'), $this->artlink_changeset_value);
 }
Esempio n. 25
0
 public function itCreatesAnArtifactNodeForEveryArtifactId()
 {
     $swmiline_id = 7;
     $artifact4 = aMockArtifact()->withId(4)->build();
     $artifact5 = aMockArtifact()->withId(5)->build();
     $artifact6 = aMockArtifact()->withId(6)->build();
     $node4 = new Cardwall_CardInCellPresenterNode(new Cardwall_CardInCellPresenter(new Cardwall_CardPresenter($artifact4, mock('Cardwall_CardFields'), '*', mock('Cardwall_UserPreferences_UserPreferencesDisplayUser'), 0, array()), 4));
     $node5 = new Cardwall_CardInCellPresenterNode(new Cardwall_CardInCellPresenter(new Cardwall_CardPresenter($artifact5, mock('Cardwall_CardFields'), '*', mock('Cardwall_UserPreferences_UserPreferencesDisplayUser'), 0, array()), 5));
     $node6 = new Cardwall_CardInCellPresenterNode(new Cardwall_CardInCellPresenter(new Cardwall_CardPresenter($artifact6, mock('Cardwall_CardFields'), '*', mock('Cardwall_UserPreferences_UserPreferencesDisplayUser'), 0, array()), 6));
     stub($this->artifact_factory)->getArtifactById(4)->returns($artifact4);
     stub($this->artifact_factory)->getArtifactById(5)->returns($artifact5);
     stub($this->artifact_factory)->getArtifactById(6)->returns($artifact6);
     stub($this->node_factory)->getCardInCellPresenterNode($artifact4, $swmiline_id)->returns($node4);
     stub($this->node_factory)->getCardInCellPresenterNode($artifact5, $swmiline_id)->returns($node5);
     stub($this->node_factory)->getCardInCellPresenterNode($artifact6, $swmiline_id)->returns($node6);
     $cards = $this->provider->getCards(array(4, 5, 6), $swmiline_id);
     $this->assertEqual(3, count($cards));
     foreach ($cards as $card) {
         $id = $card->getId();
         $this->assertBetweenClosedInterval($id, 4, 6);
         $artifact = $card->getArtifact();
         $this->assertBetweenClosedInterval($artifact->getId(), 4, 6);
         $this->assertIsA($artifact, 'Tracker_Artifact');
     }
 }
 public function setUp()
 {
     parent::setUp();
     $this->wiki_page = mock('WikiPage');
     $this->group_id = 101;
     $this->actions = mock('FullTextSearchWikiActions');
 }
Esempio n. 27
0
 public function setUp()
 {
     parent::setUp();
     $this->response = mock('Git_GitoliteHousekeeping_GitoliteHousekeepingResponse');
     $this->backend_service = mock('BackendService');
     $this->command = new Git_GitoliteHousekeeping_ChainOfResponsibility_ServiceRestarter($this->response, $this->backend_service);
 }
Esempio n. 28
0
 public function __construct()
 {
     $this->project = mock('Project');
     $this->planning = aPlanning()->build();
     $this->sub_milestones = array();
     $this->artifact = anArtifact()->build();
 }
Esempio n. 29
0
 public function setUp()
 {
     parent::setUp();
     $this->plugin = mock('gitPlugin');
     $this->driver = mock('GitDriver');
     $this->gitconfig = new GitConfig($this->plugin, $this->driver);
 }
Esempio n. 30
0
 public function __construct()
 {
     $this->dao = new MockPlanningDao();
     $this->tracker_factory = new MockTrackerFactory();
     $this->form_element_factory = mock('Tracker_FormElementFactory');
     $this->planning_permissions_manager = mock('PlanningPermissionsManager');
 }