Add {TMP} placeholder for PHPT INI sections
authorChristoph M. Becker <cmbecker69@gmx.de>
Wed, 8 May 2019 15:54:02 +0000 (17:54 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Wed, 8 May 2019 17:21:38 +0000 (19:21 +0200)
Several tests use `/tmp` in the `--INI--` section, but this is not
portable.  We therefore introduce the `{TMP}` placeholder which
evaluates to the system's temporary directory using
`sys_get_temp_dir()`.

We also remove the doubtful `strpos()` optimization.

run-tests.php

index 2801959f10f4e09ef49cf8f1abbef8e2ce0992ab..1e07509506084059121aa4624a5d7112ad742f7c 100755 (executable)
@@ -1604,9 +1604,8 @@ TEST $file
        // Any special ini settings
        // these may overwrite the test defaults...
        if (array_key_exists('INI', $section_text)) {
-               if (strpos($section_text['INI'], '{PWD}') !== false) {
-                       $section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
-               }
+               $section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
+               $section_text['INI'] = str_replace('{TMP}', sys_get_temp_dir(), $section_text['INI']);
                settings2array(preg_split( "/[\n\r]+/", $section_text['INI']), $ini_settings);
        }