Annotation of embedaddon/php/ext/zip/tests/oo_namelocate.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Locate entries by name
3: --SKIPIF--
4: <?php
1.1.1.2 ! misho 5: /* $Id$ */
1.1 misho 6: if(!extension_loaded('zip')) die('skip');
7: ?>
8: --FILE--
9: <?php
10: $dirname = dirname(__FILE__) . '/';
11: include $dirname . 'utils.inc';
12: $file = $dirname . '__tmp_oo_rename.zip';
13:
14: @unlink($file);
15:
16: $zip = new ZipArchive;
17: if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
18: exit('failed');
19: }
20:
21: $zip->addFromString('entry1.txt', 'entry #1');
22: $zip->addFromString('entry2.txt', 'entry #2');
23: $zip->addFromString('dir/entry2d.txt', 'entry #2');
24:
25: if (!$zip->status == ZIPARCHIVE::ER_OK) {
26: echo "failed to write zip\n";
27: }
28: $zip->close();
29:
30: if (!$zip->open($file)) {
31: exit('failed');
32: }
33:
34:
35: var_dump($zip->locateName('entry1.txt'));
36: var_dump($zip->locateName('eNtry2.txt'));
37: var_dump($zip->locateName('eNtry2.txt', ZIPARCHIVE::FL_NOCASE));
38: var_dump($zip->locateName('enTRy2d.txt', ZIPARCHIVE::FL_NOCASE|ZIPARCHIVE::FL_NODIR));
39: $zip->close();
40:
41: ?>
42: --EXPECTF--
43: int(0)
44: bool(false)
45: int(1)
46: int(2)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>