]> granicus.if.org Git - php/commitdiff
update _installFile() test for channels
authorGreg Beaver <cellog@php.net>
Sat, 29 May 2004 09:06:09 +0000 (09:06 +0000)
committerGreg Beaver <cellog@php.net>
Sat, 29 May 2004 09:06:09 +0000 (09:06 +0000)
pear/tests/pear_installer2.phpt

index b834de808ad41d1cf5a5434246afa6d69b6e530b..541ad71b762f43b155799be845285b06a70419a4 100644 (file)
@@ -1,5 +1,5 @@
 --TEST--
-PEAR_Installer test #2
+PEAR_Installer test _installFile()
 --SKIPIF--
 <?php
 if (!getenv('PHP_PEAR_RUNTESTS')) {
@@ -304,27 +304,28 @@ if (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR .
 }
 $installer->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():