Annotation of embedaddon/php/ext/zip/tests/oo_properties.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: ziparchive::properties isset()/empty() checks
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:
11: $dirname = dirname(__FILE__) . '/';
12: $file = $dirname . '__property_test.zip';
13:
14: copy($dirname . 'test_with_comment.zip', $file);
15:
16: $zip = new ZipArchive;
17: if (!$zip->open($file)) {
18: exit('failed');
19: }
20:
21: printf("zip->status (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->status, empty($zip->status), isset($zip->status));
22: printf("zip->numFiles (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->numFiles, empty($zip->numFiles), isset($zip->numFiles));
23: printf("zip->bogus (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->bogus, empty($zip->bogus), isset($zip->bogus));
24:
25:
26: $zip->addEmptyDir('emptydir');
27:
28: printf("zip->status (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->status, empty($zip->status), isset($zip->status));
29: printf("zip->numFiles (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->numFiles, empty($zip->numFiles), isset($zip->numFiles));
30: printf("zip->filename (%d):\n\tempty(): %d\n\tisset(): %d\n", strlen($zip->filename), empty($zip->filename), isset($zip->filename));
31: printf("zip->comment (%d):\n\tempty(): %d\n\tisset(): %d\n", strlen($zip->comment), empty($zip->comment), isset($zip->comment));
32:
33: unset($zip); //close the file before unlinking
34: @unlink($file);
35: ?>
36: --EXPECTF--
37: zip->status (0):
38: empty(): 1
39: isset(): 1
40: zip->numFiles (4):
41: empty(): 0
42: isset(): 1
43:
44: Notice: Undefined property: ZipArchive::$bogus in %s on line %d
45: zip->bogus (0):
46: empty(): 1
47: isset(): 0
48: zip->status (0):
49: empty(): 1
50: isset(): 1
51: zip->numFiles (5):
52: empty(): 0
53: isset(): 1
54: zip->filename (%d):
55: empty(): 0
56: isset(): 1
57: zip->comment (19):
58: empty(): 0
59: isset(): 1
60:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>