Annotation of embedaddon/php/ext/phar/tests/phar_extract2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: Phar::extractTo() - .phar safety
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: --INI--
6: phar.readonly=0
7: --FILE--
8: <?php
9:
10: $fname = dirname(__FILE__) . '/tempmanifest2.phar.php';
11: $pname = 'phar://' . $fname;
12:
13: $phar = new Phar($fname);
14: $phar->setDefaultStub();
15: $phar->setAlias('fred');
16: $phar['file1.txt'] = 'hi';
17: $phar['file2.txt'] = 'hi2';
18: $phar['subdir/ectory/file.txt'] = 'hi3';
19: $phar->mount($pname . '/mount', __FILE__);
20: $phar->addEmptyDir('one/level');
21:
22: $phar->extractTo(dirname(__FILE__) . '/extract', 'mount');
23: $phar->extractTo(dirname(__FILE__) . '/extract');
24: $out = array();
25:
26: foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/extract', 0x00003000), RecursiveIteratorIterator::CHILD_FIRST) as $path => $file) {
27: $extracted[] = $path;
28: }
29:
30: sort($extracted);
31:
32: foreach ($extracted as $out) {
33: echo "$out\n";
34: }
35:
36: ?>
37: ===DONE===
38: --CLEAN--
39: <?php
40: @unlink(dirname(__FILE__) . '/tempmanifest2.phar.php');
41: $dir = dirname(__FILE__) . '/extract/';
42: @unlink($dir . 'file1.txt');
43: @unlink($dir . 'file2.txt');
44: @unlink($dir . 'subdir/ectory/file.txt');
45: @rmdir($dir . 'subdir/ectory');
46: @rmdir($dir . 'subdir');
47: @rmdir($dir . 'one/level');
48: @rmdir($dir . 'one');
49: @rmdir($dir);
50: $dir = dirname(__FILE__) . '/extract1/';
51: @rmdir($dir);
52: ?>
53: --EXPECTF--
54: %sextract%cfile1.txt
55: %sextract%cfile2.txt
56: %sextract%cone
57: %sextract%csubdir
58: %sextract%csubdir%cectory
59: %sextract%csubdir%cectory%cfile.txt
60: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>