Annotation of embedaddon/php/ext/zip/tests/bug64342_0.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #64342 ZipArchive::addFile() has to check file existence (variation 1)
                      3: --SKIPIF--
                      4: <?php
                      5:        if(!extension_loaded('zip')) die('skip');
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: 
                     10: $zip = new ZipArchive;
                     11: $res = $zip->open(dirname(__FILE__) . '/bug64342.zip', ZipArchive::CREATE);
                     12: if ($res === TRUE) {
                     13:        $f = md5(uniqid()) . '.txt';
                     14:        echo "$f\n";
                     15:        $res = $zip->addFile($f);
                     16:        if (true == $res) {
                     17:                echo "add ok\n";
                     18:        } else {
                     19:                echo "add failed\n";
                     20:        }
                     21:        $res = $zip->close();
                     22:        if (true == $res) {
                     23:                echo "close ok\n";
                     24:        } else {
                     25:                echo "close failed\n";
                     26:        }
                     27: } else {
                     28:        echo "open failed\n";
                     29: }
                     30: 
                     31: 
                     32: ?>
                     33: DONE
                     34: --CLEAN--
                     35: <?php
                     36: 
                     37: @unlink(dirname(__FILE__) . '/bug64342.zip');
                     38: --EXPECTF--
                     39: %s.txt
                     40: add failed
                     41: close ok
                     42: DONE

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