Annotation of embedaddon/php/ext/zip/tests/oo_open.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: zip::open() function
                      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: $zip = new ZipArchive;
                     13: $r = $zip->open($dirname . 'nofile');
                     14: if ($r !== TRUE) {
                     15:        echo "ER_OPEN: ok\n";
                     16: } else {
                     17:        echo "ER_OPEN: FAILED\n";
                     18: }
                     19: 
                     20: $r = $zip->open($dirname . 'nofile', ZIPARCHIVE::CREATE);
                     21: if (!$r) {
                     22:        echo "create: failed\n";
                     23: } else {
                     24:        echo "create: ok\n";
                     25: }
                     26: @unlink($dirname . 'nofile');
                     27: 
                     28: $zip = new ZipArchive;
                     29: $zip->open('');
                     30: 
                     31: if (!$zip->open($dirname . 'test.zip')) {
                     32:        exit("failed 1\n");
                     33: }
                     34: 
                     35: if ($zip->status == ZIPARCHIVE::ER_OK) {
                     36:        echo "OK\n";
                     37: } else {
                     38:        echo "failed\n";
                     39: }
                     40: ?>
                     41: --EXPECTF--
                     42: ER_OPEN: ok
                     43: create: ok
                     44: 
                     45: Warning: ZipArchive::open(): Empty string as source in %s on line %d
                     46: OK

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>