diff options
author | Tim Strehle <tim@strehle.de> | 2013-09-03 14:38:52 +0200 |
---|---|---|
committer | Tim Strehle <tim@strehle.de> | 2013-09-03 14:40:43 +0200 |
commit | 5ffaf95d3f6d8634cdc218ea6bfdb24c7887148c (patch) | |
tree | 500db34f23763c9513817532943e02bb127697b5 /run-tests.php | |
parent | 04fcf6a98b8901ae7c442aa92368c82fa7bd671d (diff) | |
download | php-git-5ffaf95d3f6d8634cdc218ea6bfdb24c7887148c.tar.gz |
run-tests.php: Adding support for sections EXPECT_EXTERNAL, EXPECTF_EXTERNAL and EXPECTREGEX_EXTERNAL. (Issue 55736)
Diffstat (limited to 'run-tests.php')
-rwxr-xr-x | run-tests.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/run-tests.php b/run-tests.php index 54a12a177d..dc88ddffed 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1289,16 +1289,20 @@ TEST $file unset($section_text['FILEEOF']); } - if (@count($section_text['FILE_EXTERNAL']) == 1) { - // don't allow tests to retrieve files from anywhere but this subdirectory - $section_text['FILE_EXTERNAL'] = dirname($file) . '/' . trim(str_replace('..', '', $section_text['FILE_EXTERNAL'])); + foreach (array( 'FILE', 'EXPECT', 'EXPECTF', 'EXPECTREGEX' ) as $prefix) { + $key = $prefix . '_EXTERNAL'; - if (file_exists($section_text['FILE_EXTERNAL'])) { - $section_text['FILE'] = file_get_contents($section_text['FILE_EXTERNAL'], FILE_BINARY); - unset($section_text['FILE_EXTERNAL']); - } else { - $bork_info = "could not load --FILE_EXTERNAL-- " . dirname($file) . '/' . trim($section_text['FILE_EXTERNAL']); - $borked = true; + if (@count($section_text[$key]) == 1) { + // don't allow tests to retrieve files from anywhere but this subdirectory + $section_text[$key] = dirname($file) . '/' . trim(str_replace('..', '', $section_text[$key])); + + if (file_exists($section_text[$key])) { + $section_text[$prefix] = file_get_contents($section_text[$key], FILE_BINARY); + unset($section_text[$key]); + } else { + $bork_info = "could not load --" . $key . "-- " . dirname($file) . '/' . trim($section_text[$key]); + $borked = true; + } } } |