Annotation of embedaddon/php/ext/standard/tests/file/parse_ini_file_variation3.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test parse_ini_file() function : variation: include path searching
                      3: --CREDITS--
                      4: Dave Kelsey <d_kelsey@uk.ibm.com>
                      5: --FILE--
                      6: <?php
                      7: /* Prototype  : array parse_ini_file(string filename [, bool process_sections])
                      8:  * Description: Parse configuration file 
                      9:  * Source code: ext/standard/basic_functions.c
                     10:  * Alias to functions: 
                     11:  */
                     12: 
                     13: echo "*** Testing parse_ini_file() : variation ***\n";
                     14: $pwd = getcwd();
                     15: $f = "parse_ini_file_variation3";
                     16: $dir1 = $pwd."/".$f.".dir1";
                     17: $dir2 = $pwd."/".$f.".dir2";
                     18: $dir3 = $pwd."/".$f.".dir3";
                     19: $iniFile = "php.ini";
                     20: 
                     21: $newdirs = array($dir1, $dir2, $dir3);
                     22: $pathSep = ":";
                     23: $newIncludePath = "";
                     24: if(substr(PHP_OS, 0, 3) == 'WIN' ) {
                     25:    $pathSep = ";";
                     26: }
                     27: foreach($newdirs as $newdir) {
                     28:    mkdir($newdir);
                     29:    $newIncludePath .= $newdir.$pathSep;
                     30: }
                     31: 
                     32: set_include_path($newIncludePath);
                     33: $path = get_include_path();
                     34: echo "New include path is : " . $path . "\n";
                     35:  
                     36: $output_file = $dir2."/".$iniFile;
                     37: $iniContent = <<<FILE
                     38: error_reporting  =  E_ALL
                     39: display_errors = On
                     40: display_startup_errors = Off
                     41: log_errors = Off
                     42: log_errors_max_len = 1024
                     43: ignore_repeated_errors = Off
                     44: ignore_repeated_source = Off
                     45: report_memleaks = On
                     46: track_errors = Off
                     47: docref_root = "/phpmanual/"
                     48: docref_ext = .html
                     49: 
                     50: FILE;
                     51: 
                     52: file_put_contents($output_file, $iniContent);
                     53: var_dump(parse_ini_file($iniFile));
                     54: 
                     55: ?>
                     56: ===Done===
                     57: --CLEAN--
                     58: <?php
                     59: 
                     60: $pwd = getcwd();
                     61: $f = "parse_ini_file_variation3";
                     62: $iniFile = "php.ini";
                     63: 
                     64: $dir1 = $pwd."/".$f.".dir1";
                     65: $dir2 = $pwd."/".$f.".dir2";
                     66: $dir3 = $pwd."/".$f.".dir3";
                     67: $newdirs = array($dir1, $dir2, $dir3);
                     68: $output_file = $dir2."/".$iniFile;
                     69: 
                     70: // Tidy up after test
                     71: unlink($output_file);
                     72: foreach($newdirs as $newdir) {
                     73:    rmdir($newdir);
                     74: }
                     75: 
                     76: ?>
                     77: --EXPECTF--
                     78: *** Testing parse_ini_file() : variation ***
                     79: New include path is : %sparse_ini_file_variation3.dir1%sparse_ini_file_variation3.dir2%sparse_ini_file_variation3.dir3%S
                     80: array(11) {
                     81:   ["error_reporting"]=>
1.1.1.2 ! misho      82:   string(5) "32767"
1.1       misho      83:   ["display_errors"]=>
                     84:   string(1) "1"
                     85:   ["display_startup_errors"]=>
                     86:   string(0) ""
                     87:   ["log_errors"]=>
                     88:   string(0) ""
                     89:   ["log_errors_max_len"]=>
                     90:   string(4) "1024"
                     91:   ["ignore_repeated_errors"]=>
                     92:   string(0) ""
                     93:   ["ignore_repeated_source"]=>
                     94:   string(0) ""
                     95:   ["report_memleaks"]=>
                     96:   string(1) "1"
                     97:   ["track_errors"]=>
                     98:   string(0) ""
                     99:   ["docref_root"]=>
                    100:   string(11) "/phpmanual/"
                    101:   ["docref_ext"]=>
                    102:   string(5) ".html"
                    103: }
1.1.1.2 ! misho     104: ===Done===

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