xref: /PHP-5.5/ext/phar/tests/zip/dir.phpt (revision 16b4d8e0)
1--TEST--
2Phar: mkdir/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$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip.php';
11$pname = 'phar://' . $fname;
12$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
13$pname2 = 'phar://' . $fname2;
14$fname3 = dirname(__FILE__) . '/' . 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(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); ?>
34<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php'); ?>
35<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.php'); ?>
36--EXPECT--
37bool(true)
38bool(true)
39bool(true)
40bool(true)
41bool(false)
42bool(true)
43bool(false)
44