xref: /PHP-8.2/ext/phar/tests/zip/dir.phpt (revision 74859783)
1--TEST--
2Phar: mkdir/rmdir test zip-based
3--EXTENSIONS--
4phar
5--INI--
6phar.readonly=0
7phar.require_hash=0
8--FILE--
9<?php
10$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip.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::ZIP));
18
19$phar->addEmptyDir('test');
20var_dump($phar['test']->isDir());
21var_dump($phar['test/']->isDir());
22copy($fname, $fname2);
23mkdir($pname . '/another/dir/');
24var_dump($phar['another/dir']->isDir());
25rmdir($pname . '/another/dir/');
26copy($fname, $fname3);
27clearstatcache();
28var_dump(file_exists($pname . '/another/dir/'));
29var_dump(file_exists($pname2 . '/test/'));
30var_dump(file_exists($pname3 . '/another/dir/'));
31?>
32--CLEAN--
33<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); ?>
34<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php'); ?>
35<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.php'); ?>
36--EXPECT--
37bool(true)
38bool(true)
39bool(true)
40bool(true)
41bool(false)
42bool(true)
43bool(false)
44