xref: /PHP-7.4/ext/phar/tests/tar/dir.phpt (revision 26dfce7f)
1--TEST--
2Phar: mkdir/rmdir test tar-based
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.readonly=0
7phar.require_hash=0
8--FILE--
9<?php
10$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.tar.php';
11$pname = 'phar://' . $fname;
12$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.1.phar.php';
13$pname2 = 'phar://' . $fname2;
14$fname3 = __DIR__ . '/' . basename(__FILE__, '.php') . '.2.phar.php';
15$pname3 = 'phar://' . $fname3;
16$phar = new Phar($fname);
17var_dump($phar->isFileFormat(Phar::TAR));
18
19$phar->addEmptyDir('test');
20var_dump(isset($phar['.phar/stub.php']));
21var_dump($phar['test']->isDir());
22var_dump($phar['test/']->isDir());
23copy($fname, $fname2);
24mkdir($pname . '/another/dir/');
25var_dump($phar['another/dir']->isDir());
26rmdir($pname . '/another/dir/');
27copy($fname, $fname3);
28clearstatcache();
29var_dump(file_exists($pname . '/another/dir/'));
30var_dump(file_exists($pname2 . '/test/'));
31var_dump(file_exists($pname3 . '/another/dir/'));
32?>
33--CLEAN--
34<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.php'); ?>
35<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php'); ?>
36<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.php'); ?>
37--EXPECT--
38bool(true)
39bool(false)
40bool(true)
41bool(true)
42bool(true)
43bool(false)
44bool(true)
45bool(false)
46