Exemplo n.º 1
0
 function testCreateFileCompareMD5Checksums()
 {
     $r = new FRSRelease();
     $r->setReleaseID(456);
     $r->setPackageID(123);
     $r->setGroupID(111);
     $ff = new FRSFileFactoryTestCreateFiles();
     $f = new FRSFile();
     $f->setRelease($r);
     $f->setFileName('toto.txt');
     touch($GLOBALS['ftp_incoming_dir'] . '/toto.txt');
     $path = $GLOBALS['ftp_incoming_dir'] . '/' . $f->getFileName();
     $f->setReferenceMd5('d41d8cd98f00b204e9800998ecf8427e');
     try {
         $ff->createFile($f, FRSFileFactory::COMPUTE_MD5);
     } catch (Exception $e) {
         $this->assertIsA($e, 'FRSFileMD5SumException');
     }
     $this->assertNotNull($f->getComputedMd5());
     $this->assertTrue(FRSFileFactory::compareMd5Checksums($f->getComputedMd5(), $f->getReferenceMd5()));
     unlink($GLOBALS['ftp_incoming_dir'] . '/toto.txt');
 }