Ejemplo n.º 1
0
 function testCreateFileDbEntryMovedFile()
 {
     // Create toto.txt in the release directory
     mkdir($GLOBALS['ftp_frs_dir_prefix'] . '/prj/p123_r456');
     touch($GLOBALS['ftp_frs_dir_prefix'] . '/prj/p123_r456/toto.txt');
     touch($GLOBALS['ftp_incoming_dir'] . '/toto.txt');
     $p = new MockProject();
     $p->setReturnValue('getUnixName', 'prj');
     $r = new FRSRelease();
     $r->setReleaseID(456);
     $r->setPackageID(123);
     $r->setProject($p);
     $f = new FRSFile();
     $f->setFileName('toto.txt');
     $f->setRelease($r);
     $f->setFileLocation($GLOBALS['ftp_frs_dir_prefix'] . '/prj/p123_r456');
     $ff = new FRSFileFactoryTestCreateFiles();
     $ff->setReturnValue('moveFileForge', True);
     $ff->setReturnValue('create', False);
     try {
         $ff->createFile($f, ~FRSFileFactory::COMPUTE_MD5);
     } catch (Exception $e) {
         $this->assertIsA($e, 'FRSFileDbException');
     }
     //Cleanup
     unlink($GLOBALS['ftp_frs_dir_prefix'] . '/prj/p123_r456/toto.txt');
     unlink($GLOBALS['ftp_incoming_dir'] . '/toto.txt');
     rmdir($GLOBALS['ftp_frs_dir_prefix'] . '/prj/p123_r456');
 }