From 71e0c354ff79f6eb9a7a2302bf146e7cca484ce0 Mon Sep 17 00:00:00 2001 From: Greg Beaver Date: Sat, 29 May 2004 09:06:09 +0000 Subject: [PATCH] update _installFile() test for channels --- pear/tests/pear_installer2.phpt | 41 +++++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/pear/tests/pear_installer2.phpt b/pear/tests/pear_installer2.phpt index b834de808ad..541ad71b762 100644 --- a/pear/tests/pear_installer2.phpt +++ b/pear/tests/pear_installer2.phpt @@ -1,5 +1,5 @@ --TEST-- -PEAR_Installer test #2 +PEAR_Installer test _installFile() --SKIPIF-- rollbackFileTransaction(); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - 'Foo' . DIRECTORY_SEPARATOR . 'Mine'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . - 'Foo'); -unlink($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'installer2.phpt.testfile.php'); //cleanup chdir($curdir); -unlink ($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); -unlink ($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'php'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'Foo'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'data'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'doc' . DIRECTORY_SEPARATOR . 'Foo'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'doc'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'Foo'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'test'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'script'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'ext'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'tmp'); -rmdir($temp_path . DIRECTORY_SEPARATOR . 'bin'); -rmdir($temp_path); +cleanall($temp_path); + +// ------------------------------------------------------------------------- // + +function cleanall($dir) +{ + $dp = opendir($dir); + while ($ent = readdir($dp)) { + if ($ent == '.' || $ent == '..') { + continue; + } + if (is_dir($dir . DIRECTORY_SEPARATOR . $ent)) { + cleanall($dir . DIRECTORY_SEPARATOR . $ent); + } else { + unlink($dir . DIRECTORY_SEPARATOR . $ent); + } + } + closedir($dp); + rmdir($dir); +} ?> --EXPECT-- test _installFile():