Annotation of embedaddon/php/ext/zlib/tests/readgzfile_variation15.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test readgzfile() function : variation: use include path (relative directories in path)
                      3: --SKIPIF--
                      4: <?php 
                      5: if (!extension_loaded("zlib")) {
                      6:        print "skip - ZLIB extension not loaded"; 
                      7: }       
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: require_once('reading_include_path.inc');
                     12: 
                     13: //define the files to go into these directories, create one in dir2
                     14: set_include_path($newIncludePath);   
                     15: test_readgzfile();
                     16: restore_include_path();
                     17: 
                     18: // remove the directory structure
                     19: chdir($baseDir);
                     20: rmdir($workingDir);
                     21: foreach($newdirs as $newdir) {
                     22:    rmdir($newdir);
                     23: }
                     24: 
                     25: chdir("..");
                     26: rmdir($thisTestDir);
                     27: 
                     28: function test_readgzfile() {
                     29:    global $scriptFile, $secondFile, $firstFile, $filename;
                     30:    
                     31:    // create a file in the middle directory
                     32:    $h = gzopen($secondFile, "w");
                     33:    gzwrite($h, "This is a file in dir2");
                     34:    gzclose($h);
                     35: 
                     36:    // should read dir2 file
                     37:    echo "file content:";
                     38:    readgzfile($filename, true);
                     39:    echo "\n";
                     40: 
                     41:    //create a file in dir1
                     42:    $h = gzopen($firstFile, "w");
                     43:    gzwrite($h, "This is a file in dir1");
                     44:    gzclose($h);
                     45:    
                     46:    //should now read dir1 file
                     47:    echo "file content:";   
                     48:    readgzfile($filename, true);
                     49:    echo "\n";
                     50:    
                     51:    // create a file in working directory
                     52:    $h = gzopen($filename, "w");
                     53:    gzwrite($h, "This is a file in working dir");
                     54:    gzclose($h);
                     55:    
                     56:    //should still read dir1 file
                     57:    echo "file content:";   
                     58:    readgzfile($filename, true);
                     59:    echo "\n";
                     60:    
                     61:    unlink($firstFile);
                     62:    unlink($secondFile);
                     63:    
                     64:    //should read the file in working dir
                     65:    echo "file content:";   
                     66:    readgzfile($filename, true);
                     67:    echo "\n";
                     68:    
                     69:    // create a file in the script directory
                     70:    $h = gzopen($scriptFile, "w");
                     71:    gzwrite($h, "This is a file in script dir");
                     72:    gzclose($h);
                     73:    
                     74:    //should read the file in script dir
                     75:    echo "file content:";   
                     76:    readgzfile($filename, true);
                     77:    echo "\n";
                     78:      
                     79:    //cleanup
                     80:    unlink($filename);
                     81:    unlink($scriptFile);
                     82: 
                     83: }
                     84: 
                     85: ?>
                     86: ===DONE===
                     87: --EXPECT--
                     88: file content:This is a file in dir2
                     89: file content:This is a file in dir1
                     90: file content:This is a file in dir1
                     91: file content:This is a file in working dir
                     92: file content:This is a file in script dir
                     93: ===DONE===
                     94: 

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