Example #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());
     }
 }
Example #2
0
 /**
  * testing addition by patterns to the archive
  *
  * @since 1.0
  */
 public function testPatterns()
 {
     $reader = new Reader($this->path . 'test.zip');
     $filesPath = $this->path . 'files';
     chdir($filesPath);
     $globRes = $reader->addGlob('*.txt');
     $patternRes = $reader->addPattern('/\\.(?:txt)$/', $filesPath);
     $this->assertTrue(!empty($globRes));
     $this->assertTrue(!empty($patternRes));
 }
Example #3
0
 public function testUnzipPhar()
 {
     $this->_deleteFiles();
     $file = $this->path . 'test.tar';
     $reader = new Reader($file);
     $reader->unzip();
     $reader->unzip($this->path . 'test');
 }