コード例 #1
0
ファイル: FRSXMLImporterTest.php プロジェクト: blestab/tuleap
 public function setUp()
 {
     $package_factory = new FRSPackageFactoryMock();
     $release_factory = new FRSReleaseFactory();
     $file_factory = new FRSXMLImporterTest_FRSFileFactory();
     $this->package_dao = mock('FRSPackageDao');
     $package_factory->dao = $this->package_dao;
     FRSPackageFactory::setInstance($package_factory);
     $this->permissions_manager = mock('PermissionsManager');
     PermissionsManager::setInstance($this->permissions_manager);
     $this->release_dao = mock('FRSReleaseDao');
     $release_factory->dao = $this->release_dao;
     $release_factory->package_factory = $package_factory;
     $release_factory->file_factory = $file_factory;
     FRSReleaseFactory::setInstance($release_factory);
     $this->file_dao = mock('FRSFileDao');
     $file_factory->dao = $this->file_dao;
     $file_factory->release_factory = $release_factory;
     $this->processor_dao = mock('FRSProcessorDao');
     $this->filetype_dao = mock('FRSFileTypeDao');
     $this->user_finder = mock('User\\XML\\Import\\IFindUserFromXMLReference');
     $this->user_manager = mock('UserManager');
     UserManager::setInstance($this->user_manager);
     $this->ugroup_dao = mock("UGroupDao");
     stub($this->ugroup_dao)->searchByGroupIdAndName()->returns(new DataAccessResultEmpty());
     $this->frs_importer = new FRSXMLImporter(mock('Logger'), new XML_RNGValidator(), $package_factory, $release_factory, $file_factory, $this->user_finder, new UGroupManager($this->ugroup_dao), $this->processor_dao, $this->filetype_dao);
     EventManager::setInstance(mock('EventManager'));
     $GLOBALS['Language'] = mock('BaseLanguage');
     if (isset($GLOBALS['ftp_incoming_dir'])) {
         $this->old_ftp_incoming_dir = $GLOBALS['ftp_incoming_dir'];
     }
     if (isset($GLOBALS['old_ftp_frs_dir_prefix'])) {
         $this->old_ftp_frs_dir_prefix = $GLOBALS['ftp_frs_dir_prefix'];
     }
     $GLOBALS['ftp_incoming_dir'] = parent::getTmpDir();
     $GLOBALS['ftp_frs_dir_prefix'] = parent::getTmpDir();
 }