Exemplo n.º 1
0
 public function testCleanupFrs()
 {
     $backend = new BackendTestVersion($this);
     $daysBefore = $_SERVER['REQUEST_TIME'] - 24 * 3600 * 5;
     $ff = new MockFRSFileFactory($this);
     $ff->setReturnValue('moveFiles', true);
     //$ff->expectOnce('moveFiles', array($daysBefore, $backend));
     $wiki = new MockWikiAttachment($this);
     $wiki->setReturnValue('purgeAttachments', true);
     $backend->setReturnValue('getFRSFileFactory', $ff);
     $backend->setReturnValue('getWikiAttachment', $wiki);
     $this->assertTrue($backend->cleanupFRS());
 }
 /**
  * Project delete Succeed
  *
  * @return Void
  */
 public function testProjectDeleteSucceed()
 {
     $evt = new SystemEvent_PROJECT_DELETE_TestVersion();
     $evt->__construct('1', SystemEvent::TYPE_PROJECT_DELETE, SystemEvent::OWNER_ROOT, '142', SystemEvent::PRIORITY_HIGH, SystemEvent::STATUS_RUNNING, $_SERVER['REQUEST_TIME'], $_SERVER['REQUEST_TIME'], $_SERVER['REQUEST_TIME'], '');
     // The project
     $project = new MockProject();
     $project->setReturnValue('usesCVS', true);
     $project->setReturnValue('usesSVN', true);
     $evt->setReturnValue('getProject', $project, array('142'));
     //Remove users from project
     $evt->setReturnValue('removeProjectMembers', true);
     $evt->setReturnValue('deleteMembershipRequestNotificationEntries', true);
     //Cleanup ProjectUGroup binding
     $evt->setReturnValue('cleanupProjectUgroupsBinding', true);
     //Cleanup FRS
     $evt->setReturnValue('cleanupProjectFRS', true);
     //Delete all trackers
     $atf = new MockArtifactTypeFactory();
     $atf->setReturnValue('preDeleteAllProjectArtifactTypes', true);
     $evt->setReturnValue('getArtifactTypeFactory', $atf, array($project));
     // System
     $backendSystem = new MockBackendSystem();
     $backendSystem->setReturnValue('projectHomeExists', true);
     $backendSystem->setReturnValue('archiveProjectHome', true);
     $backendSystem->setReturnValue('archiveProjectFtp', true);
     $backendSystem->expectOnce('setNeedRefreshGroupCache');
     $evt->setReturnValue('getBackend', $backendSystem, array('System'));
     // Wiki attachments
     $wa = new MockWikiAttachment();
     $wa->setReturnValue('deleteProjectAttachments', true);
     $wa->expectOnce('deleteProjectAttachments');
     $evt->setReturnValue('getWikiAttachment', $wa);
     // CVS
     $backendCVS = new MockBackendCVS();
     $backendCVS->setReturnValue('repositoryExists', true);
     $backendCVS->setReturnValue('archiveProjectCVS', true);
     $backendCVS->expectOnce('setCVSRootListNeedUpdate');
     $evt->setReturnValue('getBackend', $backendCVS, array('CVS'));
     // SVN
     $backendSVN = new MockBackendSVN();
     $backendSVN->setReturnValue('repositoryExists', true);
     $backendSVN->setReturnValue('archiveProjectSVN', true);
     $backendSVN->expectOnce('setSVNApacheConfNeedUpdate');
     $evt->setReturnValue('getBackend', $backendSVN, array('SVN'));
     // MailingList
     $backendMailingList = new MockBackendMailingList();
     $backendMailingList->setReturnValue('deleteProjectMailingLists', true);
     $backendMailingList->expectOnce('deleteProjectMailingLists');
     $evt->setReturnValue('getBackend', $backendMailingList, array('MailingList'));
     // Aliases
     $backendAliases = new MockBackendAliases();
     $backendAliases->expectOnce('setNeedUpdateMailAliases');
     $evt->setReturnValue('getBackend', $backendAliases, array('Aliases'));
     // Expect everything went OK
     $evt->expectOnce('done');
     $evt->expectNever('error');
     $em = new MockEventManager();
     $evt->setReturnValue('getEventManager', $em);
     // Launch the event
     $this->assertTrue($evt->process());
 }