From f8369d7d6e37248d6523fdac6e1d760fca4f1b52 Mon Sep 17 00:00:00 2001 From: Tobias Sarnowski Date: Wed, 18 Apr 2012 12:08:28 +0200 Subject: moved _testing to _test --- _test/core/TestUtils.php | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 _test/core/TestUtils.php (limited to '_test/core/TestUtils.php') diff --git a/_test/core/TestUtils.php b/_test/core/TestUtils.php new file mode 100644 index 000000000..64de62213 --- /dev/null +++ b/_test/core/TestUtils.php @@ -0,0 +1,68 @@ +read())) { + if ($entry == '.' || $entry == '..') { + continue; + } + TestUtils::rcopy($newdestdir, $source.'/'.$entry); + } + $dh->close(); + } + } + + /** + * helper for recursive rmdir()/unlink() + * + * @static + * @param $target string + */ + public static function rdelete($target) { + if (!is_dir($target)) { + unlink($target); + } else { + $dh = dir($target); + while (false !== ($entry = $dh->read())) { + if ($entry == '.' || $entry == '..') { + continue; + } + TestUtils::rdelete("$target/$entry"); + } + $dh->close(); + rmdir($target); + } + } + + /** + * helper to append text to a file + * + * @static + * @param $file string + * @param $text string + */ + public static function fappend($file, $text) { + $fh = fopen($file, 'a'); + fwrite($fh, $text); + fclose($fh); + } + +} -- cgit v1.2.3 From 9c6354e5be3db406fa7f0966d65063e1d3b4d242 Mon Sep 17 00:00:00 2001 From: Tobias Sarnowski Date: Wed, 18 Apr 2012 18:04:25 +0000 Subject: use original conf directory and only shadow special files https://github.com/splitbrain/dokuwiki/pull/96#issuecomment-5195756 --- _test/core/TestUtils.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '_test/core/TestUtils.php') diff --git a/_test/core/TestUtils.php b/_test/core/TestUtils.php index 64de62213..2750a3edf 100644 --- a/_test/core/TestUtils.php +++ b/_test/core/TestUtils.php @@ -17,7 +17,9 @@ class TestUtils { copy($source, $destdir.'/'.basename($source)); } else { $newdestdir = $destdir.'/'.basename($source); - mkdir($newdestdir); + if (!is_dir($newdestdir)) { + mkdir($newdestdir); + } $dh = dir($source); while (false !== ($entry = $dh->read())) { -- cgit v1.2.3