Exemple #1
0
 public function testAllMethodsPhar()
 {
     $zipFile = $this->path . 'test.bz2';
     $reader = new Reader($zipFile);
     $files = $reader->getFiles();
     foreach ($files as $file) {
         $this->assertEquals(false, $file->getIndex());
         $this->assertInternalType('string', $file->getName());
         $this->assertEquals('txt', $file->getExtension());
         $this->assertInternalType('int', $file->getModifiedAt());
         $this->assertInternalType('string', $file->getModifiedAt('d/m/y'));
         $this->assertInstanceOf('Elibyy\\Adapters\\PharAdapter', $file->getAdapter());
         $this->assertInternalType('int', $file->getSize());
         $this->assertInternalType('int', $file->getCompressedSize());
         $file->setComment('test');
         $this->assertEquals(false, $file->getComment());
         $this->assertInternalType('numeric', $file->getCrc());
         $this->assertEquals(false, $file->getCompressionMethod());
         $this->assertInternalType('string', $file->getStringCompressionMethod());
     }
 }
Exemple #2
0
 /**
  * testing removal of file from the archive
  *
  * @since 1.0
  */
 public function testRemoveFile()
 {
     $reader = new Reader($this->path . 'test.zip');
     $files = $reader->getFiles();
     $file1 = $files[0];
     $file2 = $files[1];
     $res1 = $reader->removeFileByObject($file1);
     $res2 = $reader->removeFileByName($file2->getName());
     $this->assertTrue($res1);
     $this->assertTrue($res2);
 }