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