Annotation of embedaddon/php/ext/standard/tests/file/glob_variation2.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test glob() function with relative path
                      3: --FILE--
                      4: <?php
                      5: /* Prototype: array glob ( string $pattern [, int $flags] );
                      6:    Description: Find pathnames matching a pattern
                      7: */
                      8: 
                      9: $file_path = dirname(__FILE__);
                     10: 
                     11: // temp dirname used here
                     12: $dir_name = 'glob_test';
                     13: 
                     14: // create temp directory
                     15: mkdir("$file_path/$dir_name");
                     16: 
                     17: // create temp file
                     18: $fp = fopen("$file_path/$dir_name/file.text", "w");
                     19: fclose($fp);
                     20: 
                     21: echo "Testing glob() with relative paths:\n";
                     22: 
                     23: chdir("$file_path/$dir_name");
                     24: var_dump( glob("./*") );
                     25: var_dump( glob("../$dir_name/*"));
                     26: 
                     27: chdir("$file_path");
                     28: var_dump( glob("$dir_name/*"));
                     29: var_dump( glob("$dir_name"));
                     30: 
                     31: echo "Done\n";
                     32: ?>
                     33: --CLEAN--
                     34: <?php
                     35: $file_path = dirname(__FILE__);
                     36: unlink("$file_path/glob_test/file.text");
                     37: rmdir("$file_path/glob_test/");
                     38: ?>
                     39: --EXPECT--
                     40: Testing glob() with relative paths:
                     41: array(1) {
                     42:   [0]=>
                     43:   string(11) "./file.text"
                     44: }
                     45: array(1) {
                     46:   [0]=>
                     47:   string(22) "../glob_test/file.text"
                     48: }
                     49: array(1) {
                     50:   [0]=>
                     51:   string(19) "glob_test/file.text"
                     52: }
                     53: array(1) {
                     54:   [0]=>
                     55:   string(9) "glob_test"
                     56: }
                     57: Done

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