@@ -79,7 +79,7 @@ public function testCreateDynamic()
79
79
{
80
80
$ tar = new Tar ();
81
81
82
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
82
+ $ dir = __DIR__ . '/tar ' ;
83
83
$ tdir = ltrim ($ dir , '/ ' );
84
84
85
85
$ tar ->create ();
@@ -117,7 +117,7 @@ public function testCreateFile()
117
117
{
118
118
$ tar = new Tar ();
119
119
120
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
120
+ $ dir = __DIR__ . '/tar ' ;
121
121
$ tdir = ltrim ($ dir , '/ ' );
122
122
$ tmp = vfsStream::url ('home_root_path/test.tar ' );
123
123
@@ -153,7 +153,7 @@ public function testCreateFile()
153
153
*/
154
154
public function testTarcontent ()
155
155
{
156
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
156
+ $ dir = __DIR__ . '/tar ' ;
157
157
158
158
foreach ($ this ->extensions as $ ext ) {
159
159
$ tar = new Tar ();
@@ -178,7 +178,7 @@ public function testTarcontent()
178
178
public function testDogfood ()
179
179
{
180
180
foreach ($ this ->extensions as $ ext ) {
181
- $ input = glob (dirname ( __FILE__ ) . '/../src/* ' );
181
+ $ input = glob (__DIR__ . '/../src/* ' );
182
182
$ archive = sys_get_temp_dir () . '/dwtartest ' . md5 (time ()) . '. ' . $ ext ;
183
183
$ extract = sys_get_temp_dir () . '/dwtartest ' . md5 (time () + 1 );
184
184
@@ -250,7 +250,7 @@ protected function nativeCheck($archive, $ext)
250
250
*/
251
251
public function testTarExtract ()
252
252
{
253
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
253
+ $ dir = __DIR__ . '/tar ' ;
254
254
$ out = sys_get_temp_dir () . '/dwtartest ' . md5 (time ());
255
255
256
256
foreach ($ this ->extensions as $ ext ) {
@@ -277,7 +277,7 @@ public function testTarExtract()
277
277
*/
278
278
public function testCompStripExtract ()
279
279
{
280
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
280
+ $ dir = __DIR__ . '/tar ' ;
281
281
$ out = sys_get_temp_dir () . '/dwtartest ' . md5 (time ());
282
282
283
283
foreach ($ this ->extensions as $ ext ) {
@@ -304,7 +304,7 @@ public function testCompStripExtract()
304
304
*/
305
305
public function testPrefixStripExtract ()
306
306
{
307
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
307
+ $ dir = __DIR__ . '/tar ' ;
308
308
$ out = sys_get_temp_dir () . '/dwtartest ' . md5 (time ());
309
309
310
310
foreach ($ this ->extensions as $ ext ) {
@@ -331,7 +331,7 @@ public function testPrefixStripExtract()
331
331
*/
332
332
public function testIncludeExtract ()
333
333
{
334
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
334
+ $ dir = __DIR__ . '/tar ' ;
335
335
$ out = sys_get_temp_dir () . '/dwtartest ' . md5 (time ());
336
336
337
337
foreach ($ this ->extensions as $ ext ) {
@@ -357,7 +357,7 @@ public function testIncludeExtract()
357
357
*/
358
358
public function testExcludeExtract ()
359
359
{
360
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
360
+ $ dir = __DIR__ . '/tar ' ;
361
361
$ out = sys_get_temp_dir () . '/dwtartest ' . md5 (time ());
362
362
363
363
foreach ($ this ->extensions as $ ext ) {
@@ -394,7 +394,7 @@ public function testFileType()
394
394
$ this ->assertEquals (Tar::COMPRESS_BZIP , $ tar ->filetype ('foo.tar.BZ2 ' ));
395
395
$ this ->assertEquals (Tar::COMPRESS_BZIP , $ tar ->filetype ('foo.tar.bz2 ' ));
396
396
397
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
397
+ $ dir = __DIR__ . '/tar ' ;
398
398
$ this ->assertEquals (Tar::COMPRESS_NONE , $ tar ->filetype ("$ dir/test.tar " ));
399
399
$ this ->assertEquals (Tar::COMPRESS_GZIP , $ tar ->filetype ("$ dir/test.tgz " ));
400
400
$ this ->assertEquals (Tar::COMPRESS_BZIP , $ tar ->filetype ("$ dir/test.tbz " ));
@@ -408,7 +408,7 @@ public function testFileType()
408
408
*/
409
409
public function testLongPathExtract ()
410
410
{
411
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
411
+ $ dir = __DIR__ . '/tar ' ;
412
412
$ out = vfsStream::url ('home_root_path/dwtartest ' . md5 (time ()));
413
413
414
414
foreach (array ('ustar ' , 'gnu ' ) as $ format ) {
@@ -504,7 +504,7 @@ public function testCreateLongPathGnu()
504
504
*/
505
505
public function testTarBomb ()
506
506
{
507
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
507
+ $ dir = __DIR__ . '/tar ' ;
508
508
$ out = vfsStream::url ('home_root_path/dwtartest ' . md5 (time ()));
509
509
510
510
$ tar = new Tar ();
@@ -524,7 +524,7 @@ public function testTarBomb()
524
524
*/
525
525
public function testZeroFile ()
526
526
{
527
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
527
+ $ dir = __DIR__ . '/tar ' ;
528
528
$ tar = new Tar ();
529
529
$ tar ->setCompression (0 );
530
530
$ tar ->create ();
@@ -582,7 +582,7 @@ public function testZeroByteFile() {
582
582
*/
583
583
public function testBlockFile ()
584
584
{
585
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
585
+ $ dir = __DIR__ . '/tar ' ;
586
586
$ tar = new Tar ();
587
587
$ tar ->setCompression (0 );
588
588
$ tar ->create ();
@@ -609,7 +609,7 @@ public function testBlockData()
609
609
public function testGzipIsValid ()
610
610
{
611
611
foreach (['tgz ' , 'tar.gz ' ] as $ ext ) {
612
- $ input = glob (dirname ( __FILE__ ) . '/../src/* ' );
612
+ $ input = glob (__DIR__ . '/../src/* ' );
613
613
$ archive = sys_get_temp_dir () . '/dwtartest ' . md5 (time ()) . '. ' . $ ext ;
614
614
$ extract = sys_get_temp_dir () . '/dwtartest ' . md5 (time () + 1 );
615
615
@@ -649,7 +649,7 @@ public function testContentsWithInvalidArchiveStream()
649
649
public function testExtractWithInvalidOutDir ()
650
650
{
651
651
$ this ->expectException (ArchiveIOException::class);
652
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
652
+ $ dir = __DIR__ . '/tar ' ;
653
653
$ out = '/root/invalid_out_dir ' ;
654
654
655
655
$ tar = new Tar ();
@@ -661,7 +661,7 @@ public function testExtractWithInvalidOutDir()
661
661
public function testExtractWithArchiveStreamIsClosed ()
662
662
{
663
663
$ this ->expectException (ArchiveIOException::class);
664
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
664
+ $ dir = __DIR__ . '/tar ' ;
665
665
$ out = '/root/invalid_out_dir ' ;
666
666
667
667
$ tar = new Tar ();
@@ -674,7 +674,7 @@ public function testExtractWithArchiveStreamIsClosed()
674
674
public function testCreateWithInvalidFile ()
675
675
{
676
676
$ this ->expectException (ArchiveIOException::class);
677
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
677
+ $ dir = __DIR__ . '/tar ' ;
678
678
$ tar = new Tar ();
679
679
680
680
$ tar ->open ("$ dir/tarbomb.tgz " );
@@ -730,7 +730,7 @@ public function testCloseHasBeenClosed()
730
730
*/
731
731
public function testGetArchiveWithBzipCompress ()
732
732
{
733
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
733
+ $ dir = __DIR__ . '/tar ' ;
734
734
$ tar = new Tar ();
735
735
$ tar ->setCompression (9 , Tar::COMPRESS_BZIP );
736
736
$ tar ->create ();
@@ -742,7 +742,7 @@ public function testGetArchiveWithBzipCompress()
742
742
743
743
public function testSaveWithCompressionAuto ()
744
744
{
745
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
745
+ $ dir = __DIR__ . '/tar ' ;
746
746
$ tar = new Tar ();
747
747
$ tar ->setCompression (-1 );
748
748
$ tar ->create ();
@@ -755,7 +755,7 @@ public function testSaveWithCompressionAuto()
755
755
public function testSaveWithInvalidDestinationFile ()
756
756
{
757
757
$ this ->expectException (ArchiveIOException::class);
758
- $ dir = dirname ( __FILE__ ) . '/tar ' ;
758
+ $ dir = __DIR__ . '/tar ' ;
759
759
$ tar = new Tar ();
760
760
$ tar ->setCompression ();
761
761
$ tar ->create ();
0 commit comments