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

1.1     ! misho       1: --TEST--
        !             2: Test gzopen() function : variation: use include path and stream context create a file, relative path
        !             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: require_once('gzopen_include_path.inc');
        !            18: 
        !            19: echo "*** Testing gzopen() : variation ***\n";
        !            20: $thisTestDir = "gzopenVariation5.dir";
        !            21: mkdir($thisTestDir);
        !            22: chdir($thisTestDir);
        !            23: 
        !            24: $newpath = relative_include_path();
        !            25: set_include_path($newpath);
        !            26: runtest();
        !            27: $newpath = generate_next_rel_path();
        !            28: set_include_path($newpath);
        !            29: runtest();
        !            30: 
        !            31: teardown_relative_path();
        !            32: restore_include_path();
        !            33: chdir("..");
        !            34: rmdir($thisTestDir);
        !            35: 
        !            36: function runtest() {
        !            37:        $tmpfile = 'gzopen_variation5.tmp';
        !            38:        $h = gzopen($tmpfile, "w", true);
        !            39:        fwrite($h, "This is the test file");
        !            40:        fclose($h);
        !            41:        
        !            42:        
        !            43:        $h = @gzopen($tmpfile, "r");
        !            44:        if ($h === false) {
        !            45:           echo "Not created in working dir\n";
        !            46:        }
        !            47:        else {
        !            48:           echo "created in working dir\n";
        !            49:           gzclose($h);
        !            50:           unlink($tmpfile);
        !            51:        }
        !            52:        
        !            53:        $h = @gzopen('dir1/'.$tmpfile, "r");
        !            54:        if ($h === false) {
        !            55:           echo "Not created in dir1\n";
        !            56:        }
        !            57:        else {
        !            58:           echo "created in dir1\n";
        !            59:           gzclose($h);
        !            60:           unlink('dir1/'.$tmpfile);   
        !            61:        }
        !            62: }
        !            63: ?>
        !            64: ===DONE===
        !            65: --EXPECT--
        !            66: *** Testing gzopen() : variation ***
        !            67: created in working dir
        !            68: Not created in dir1
        !            69: created in working dir
        !            70: Not created in dir1
        !            71: ===DONE===

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