xref: /PHP-5.6/ext/phar/tests/mkdir.phpt (revision de5aaaa7)
1--TEST--
2phar: mkdir/rmdir edge cases
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.readonly=0
7--FILE--
8<?php
9$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
10$pname = 'phar://' . $fname;
11Phar::interceptFileFuncs();
12mkdir('phar://');
13mkdir('phar://foo.phar');
14$a = new Phar($fname);
15$a['a'] = 'hi';
16mkdir($pname . '/a');
17rmdir('phar://');
18rmdir('phar://foo.phar');
19rmdir($pname . '/a');
20$a->addEmptyDir('bb');
21$a->addEmptyDir('bb');
22try {
23$a->addEmptyDir('.phar');
24} catch (Exception $e) {
25echo $e->getMessage(),"\n";
26}
27?>
28===DONE===
29--CLEAN--
30<?php
31unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
32__HALT_COMPILER();
33?>
34--EXPECTF--
35Warning: mkdir(): phar error: cannot create directory "phar://", no phar archive specified in %smkdir.php on line %d
36
37Warning: mkdir(): phar error: cannot create directory "" in phar "foo.phar", phar error: invalid path "" must not be empty in %smkdir.php on line %d
38
39Warning: mkdir(): phar error: cannot create directory "a" in phar "%smkdir.phar.php", phar error: path "a" exists and is a not a directory in %smkdir.php on line %d
40
41Warning: rmdir(): phar error: cannot remove directory "phar://", no phar archive specified, or phar archive does not exist in %smkdir.php on line %d
42
43Warning: rmdir(): phar error: cannot remove directory "" in phar "foo.phar", directory does not exist in %smkdir.php on line %d
44
45Warning: rmdir(): phar error: cannot remove directory "a" in phar "%smkdir.phar.php", phar error: path "a" exists and is a not a directory in %smkdir.php on line %d
46Cannot create a directory in magic ".phar" directory
47===DONE===