diff options
author | Joseph Warner <hardolaf@hardolaf.com> | 2013-06-26 19:51:52 -0400 |
---|---|---|
committer | Joseph Warner <hardolaf@hardolaf.com> | 2013-06-26 19:51:52 -0400 |
commit | 8e575487ff73f3b9c05aceba7b71f06c6e0b032a (patch) | |
tree | 4a9c5eafdb08d26ba84fb9592d3f77b424bfec97 /tests/template | |
parent | 4828cb21cf86475bc45a34980e88af3db975228b (diff) | |
download | forums-8e575487ff73f3b9c05aceba7b71f06c6e0b032a.tar forums-8e575487ff73f3b9c05aceba7b71f06c6e0b032a.tar.gz forums-8e575487ff73f3b9c05aceba7b71f06c6e0b032a.tar.bz2 forums-8e575487ff73f3b9c05aceba7b71f06c6e0b032a.tar.xz forums-8e575487ff73f3b9c05aceba7b71f06c6e0b032a.zip |
[ticket/11618] Replace glob() with scandir() and string matching
Removes glob from template tests as glob() does not work on all
systems according to PHP documentation as has been noticed by users.
PHPBB3-11618
Diffstat (limited to 'tests/template')
-rw-r--r-- | tests/template/template_test.php | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/template/template_test.php b/tests/template/template_test.php index e532de294c..fd68124c89 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -69,9 +69,14 @@ class phpbb_template_template_test extends phpbb_test_case $this->markTestSkipped("Template cache directory ({$template_cache_dir}) is not writable."); } - foreach (glob($this->template->cachepath . '*') as $file) + $file_array = scandir($template_cache_dir); + $file_prefix = basename($this->template->cachepath); + foreach ($file_array as $file) { - unlink($file); + if (strpos($file, $file_prefix) === 0) + { + unlink($template_cache_dir . '/' . $file); + } } $GLOBALS['config'] = array( @@ -84,9 +89,15 @@ class phpbb_template_template_test extends phpbb_test_case { if (is_object($this->template)) { - foreach (glob($this->template->cachepath . '*') as $file) + $template_cache_dir = dirname($this->template->cachepath); + $file_array = scandir($template_cache_dir); + $file_prefix = basename($this->template->cachepath); + foreach ($file_array as $file) { - unlink($file); + if (strpos($file, $file_prefix) === 0) + { + unlink($template_cache_dir . '/' . $file); + } } } } |