File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55composer.lock
66apigen.phar
77docs /
8-
8+ nbproject /
Original file line number Diff line number Diff line change @@ -356,7 +356,7 @@ public function getArchive()
356356 }
357357
358358 if ($ this ->comptype === Archive::COMPRESS_GZIP ) {
359- return gzcompress ($ this ->memory , $ this ->complevel );
359+ return gzencode ($ this ->memory , $ this ->complevel );
360360 }
361361 if ($ this ->comptype === Archive::COMPRESS_BZIP ) {
362362 return bzcompress ($ this ->memory );
Original file line number Diff line number Diff line change @@ -556,6 +556,41 @@ public function test_blockdata()
556556
557557 $ this ->assertEquals (512 * 4 , strlen ($ file )); // 1 header block + data block + 2 footer blocks
558558 }
559+
560+ /**
561+ * @depends test_ext_zlib
562+ */
563+ public function test_gzipisvalid ()
564+ {
565+ foreach (['tgz ' , 'tar.gz ' ] as $ ext ) {
566+ $ input = glob (dirname (__FILE__ ) . '/../src/* ' );
567+ $ archive = sys_get_temp_dir () . '/dwtartest ' . md5 (time ()) . '. ' . $ ext ;
568+ $ extract = sys_get_temp_dir () . '/dwtartest ' . md5 (time () + 1 );
569+
570+ $ tar = new Tar ();
571+ $ tar ->setCompression (9 , Tar::COMPRESS_GZIP );
572+ $ tar ->create ();
573+ foreach ($ input as $ path ) {
574+ $ file = basename ($ path );
575+ $ tar ->addFile ($ path , $ file );
576+ }
577+ $ tar ->save ($ archive );
578+ $ this ->assertFileExists ($ archive );
579+
580+ try {
581+ $ phar = new PharData ($ archive );
582+ $ phar ->extractTo ($ extract );
583+ } catch (\Exception $ e ) {};
584+
585+ $ this ->assertFileExists ("$ extract/Tar.php " );
586+ $ this ->assertFileExists ("$ extract/Zip.php " );
587+
588+ $ this ->nativeCheck ($ archive , $ ext );
589+
590+ self ::rdelete ($ extract );
591+ unlink ($ archive );
592+ }
593+ }
559594
560595 /**
561596 * recursive rmdir()/unlink()
You can’t perform that action at this time.
0 commit comments