xref: /PHP-7.0/ext/phar/tests/zip/rmdir.phpt (revision 5bc11220)
1--TEST--
2Phar: rmdir test zip-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
11$fname = dirname(__FILE__) . '/' . 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(dirname(__FILE__) . '/' . 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