Annotation of embedaddon/php/ext/phar/tests/phar_buildfromdirectory4.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar::buildFromDirectory(), directory exists
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: --INI--
6: phar.require_hash=0
7: phar.readonly=0
8: open_basedir=
9: --FILE--
10: <?php
11:
12: mkdir(dirname(__FILE__).'/testdir');
13: foreach(range(1, 4) as $i) {
14: file_put_contents(dirname(__FILE__)."/testdir/file$i.txt", "some content for file $i");
15: }
16:
17: try {
18: $phar = new Phar(dirname(__FILE__) . '/buildfromdirectory.phar');
19: $a = $phar->buildFromDirectory(dirname(__FILE__) . '/testdir');
20: asort($a);
21: var_dump($a);
22: } catch (Exception $e) {
23: var_dump(get_class($e));
24: echo $e->getMessage() . "\n";
25: }
26:
27: var_dump(file_exists(dirname(__FILE__) . '/buildfromdirectory.phar'));
28:
29: ?>
30: ===DONE===
31: --CLEAN--
32: <?php
33: unlink(dirname(__FILE__) . '/buildfromdirectory.phar');
34: foreach(range(1, 4) as $i) {
35: unlink(dirname(__FILE__) . "/testdir/file$i.txt");
36: }
37: rmdir(dirname(__FILE__) . '/testdir');
38: ?>
39: --EXPECTF--
40: array(4) {
41: ["file1.txt"]=>
42: string(%d) "%stestdir%cfile1.txt"
43: ["file2.txt"]=>
44: string(%d) "%stestdir%cfile2.txt"
45: ["file3.txt"]=>
46: string(%d) "%stestdir%cfile3.txt"
47: ["file4.txt"]=>
48: string(%d) "%stestdir%cfile4.txt"
49: }
50: bool(true)
51: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>