Annotation of embedaddon/php/ext/zlib/tests/gzopen_basic2.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test gzopen() function : basic functionality for writing
        !             3: --SKIPIF--
        !             4: <?php 
        !             5: if (!extension_loaded("zlib")) {
        !             6:        print "skip - ZLIB extension not loaded"; 
        !             7: }       
        !             8: ?>
        !             9: --FILE--
        !            10: <?php
        !            11: /* Prototype  : resource gzopen(string filename, string mode [, int use_include_path])
        !            12:  * Description: Open a .gz-file and return a .gz-file pointer 
        !            13:  * Source code: ext/zlib/zlib.c
        !            14:  * Alias to functions: 
        !            15:  */
        !            16: 
        !            17: echo "*** Testing gzopen() : basic functionality ***\n";
        !            18: 
        !            19: 
        !            20: // Initialise all required variables
        !            21: $filename = "temp.txt.gz";
        !            22: $modes = array('w', 'w+');
        !            23: $data = "This was the information that was written";
        !            24: 
        !            25: foreach($modes as $mode) {
        !            26:    echo "testing mode -- $mode --\n";
        !            27:    $h = gzopen($filename, $mode);
        !            28:    if ($h !== false) {
        !            29:       gzwrite($h, $data);
        !            30:       gzclose($h);
        !            31:       $h = gzopen($filename, 'r');
        !            32:       gzpassthru($h);
        !            33:       gzclose($h);
        !            34:       echo "\n";
        !            35:       unlink($filename);
        !            36:    }
        !            37:    else {
        !            38:       var_dump($h);
        !            39:    }
        !            40: }      
        !            41:       
        !            42: ?>
        !            43: ===DONE===
        !            44: --EXPECTF--
        !            45: *** Testing gzopen() : basic functionality ***
        !            46: testing mode -- w --
        !            47: This was the information that was written
        !            48: testing mode -- w+ --
        !            49: 
        !            50: Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
        !            51: bool(false)
        !            52: ===DONE===

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