xref: /PHP-8.2/ext/phar/tests/zip/rmdir.phpt (revision 74859783)
1--TEST--
2Phar: rmdir test zip-based
3--EXTENSIONS--
4phar
5--INI--
6phar.readonly=0
7phar.require_hash=0
8--FILE--
9<?php
10
11$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip';
12$alias = 'phar://' . $fname;
13
14$phar = new Phar($fname);
15$phar->setStub("<?php
16Phar::mapPhar('hio');
17__HALT_COMPILER(); ?>");
18$phar->addEmptyDir('a');
19$phar['a/x'] = 'a';
20$phar->stopBuffering();
21
22include $fname;
23
24echo file_get_contents($alias . '/a/x') . "\n";
25var_dump(rmdir($alias . '/a'));
26echo file_get_contents($alias . '/a/x') . "\n";
27unlink($alias . '/a/x');
28var_dump(rmdir($alias . '/a'));
29?>
30--CLEAN--
31<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
32--EXPECTF--
33a
34
35Warning: rmdir(): phar error: Directory not empty in %srmdir.php on line %d
36bool(false)
37a
38bool(true)
39