From f9bc86556efdefbd08ec14458efb5b62842ead0c Mon Sep 17 00:00:00 2001 From: SVN Migration Date: Thu, 18 Dec 2003 09:50:21 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create branch 'PHP_4_3'. --- ext/mbstring/tests/bug26639.phpt | 100 +++ .../dirtree/multiplepackages/pkg1file.php | 0 .../dirtree/multiplepackages/pkg2file.php | 0 .../dirtree/nestedroot/emptydir/fakefile1.php | 0 .../emptydir/nesteddir/nestedfile.php | 0 pear/tests/dirtree/nestedroot/rootfile.php | 0 pear/tests/dirtree/package-fail.xml | 42 ++ pear/tests/dirtree/package.xml | 36 ++ pear/tests/dirtree/package2.xml | 41 ++ pear/tests/dirtree/pkg1-1.0.tgz | Bin 0 -> 560 bytes pear/tests/dirtree/pkg2-1.0.tgz | Bin 0 -> 608 bytes pear/tests/pear_downloader_invalid.phpt | 366 +++++++++++ pear/tests/pear_downloader_new.phpt | 570 +++++++++++++++++ pear/tests/pear_downloader_old.phpt | 598 ++++++++++++++++++ pear/tests/pear_installer5.phpt | 226 +++++++ pear/tests/pear_packager.phpt | 432 +++++++++++++ 16 files changed, 2411 insertions(+) create mode 100644 ext/mbstring/tests/bug26639.phpt create mode 100644 pear/tests/dirtree/multiplepackages/pkg1file.php create mode 100644 pear/tests/dirtree/multiplepackages/pkg2file.php create mode 100644 pear/tests/dirtree/nestedroot/emptydir/fakefile1.php create mode 100644 pear/tests/dirtree/nestedroot/emptydir/nesteddir/nestedfile.php create mode 100644 pear/tests/dirtree/nestedroot/rootfile.php create mode 100644 pear/tests/dirtree/package-fail.xml create mode 100644 pear/tests/dirtree/package.xml create mode 100644 pear/tests/dirtree/package2.xml create mode 100644 pear/tests/dirtree/pkg1-1.0.tgz create mode 100644 pear/tests/dirtree/pkg2-1.0.tgz create mode 100644 pear/tests/pear_downloader_invalid.phpt create mode 100644 pear/tests/pear_downloader_new.phpt create mode 100644 pear/tests/pear_downloader_old.phpt create mode 100644 pear/tests/pear_installer5.phpt create mode 100644 pear/tests/pear_packager.phpt diff --git a/ext/mbstring/tests/bug26639.phpt b/ext/mbstring/tests/bug26639.phpt new file mode 100644 index 0000000000..651e6f45be --- /dev/null +++ b/ext/mbstring/tests/bug26639.phpt @@ -0,0 +1,100 @@ +--TEST-- +Bug #26639 (mb_convert_variables() clutters variables beyond the references) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(10) "‚ ‚¢‚¤‚¦‚¨" refcount(2) +string(10) "¤¢¤¤¤¦¤¨¤ª" refcount(2) +string(10) "¤¢¤¤¤¦¤¨¤ª" refcount(1) +string(10) "¤¢¤¤¤¦¤¨¤ª" refcount(1) +array(1) refcount(2){ + [0]=> + string(10) "‚ ‚¢‚¤‚¦‚¨" refcount(2) +} +array(1) refcount(2){ + [0]=> + string(10) "¤¢¤¤¤¦¤¨¤ª" refcount(1) +} +array(1) refcount(2){ + [0]=> + &string(10) "‚ ‚¢‚¤‚¦‚¨" refcount(2) +} +array(1) refcount(2){ + [0]=> + string(10) "¤¢¤¤¤¦¤¨¤ª" refcount(1) +} +array(1) refcount(1){ + [0]=> + string(10) "¤¢¤¤¤¦¤¨¤ª" refcount(2) +} +array(1) refcount(1){ + [0]=> + string(10) "¤¢¤¤¤¦¤¨¤ª" refcount(2) +} +array(1) refcount(1){ + [0]=> + string(10) "¤¢¤¤¤¦¤¨¤ª" refcount(2) +} +array(1) refcount(1){ + [0]=> + string(10) "¤¢¤¤¤¦¤¨¤ª" refcount(2) +} + diff --git a/pear/tests/dirtree/multiplepackages/pkg1file.php b/pear/tests/dirtree/multiplepackages/pkg1file.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pear/tests/dirtree/multiplepackages/pkg2file.php b/pear/tests/dirtree/multiplepackages/pkg2file.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pear/tests/dirtree/nestedroot/emptydir/fakefile1.php b/pear/tests/dirtree/nestedroot/emptydir/fakefile1.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pear/tests/dirtree/nestedroot/emptydir/nesteddir/nestedfile.php b/pear/tests/dirtree/nestedroot/emptydir/nesteddir/nestedfile.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pear/tests/dirtree/nestedroot/rootfile.php b/pear/tests/dirtree/nestedroot/rootfile.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pear/tests/dirtree/package-fail.xml b/pear/tests/dirtree/package-fail.xml new file mode 100644 index 0000000000..f2bf6f15d9 --- /dev/null +++ b/pear/tests/dirtree/package-fail.xml @@ -0,0 +1,42 @@ + + + + pkg2 + required test for PEAR_Installer + + fake package + + PHP License + + + fakeuser + Joe Shmoe + nobody@example.com + lead + + + + 1.0 + 2003-12-11 + stable + + second package + + + + + pkg2file.php + + + rootfile.php + + + nestedfile.php + doesntexist.php + + + + + + + diff --git a/pear/tests/dirtree/package.xml b/pear/tests/dirtree/package.xml new file mode 100644 index 0000000000..8ba556e5d0 --- /dev/null +++ b/pear/tests/dirtree/package.xml @@ -0,0 +1,36 @@ + + + + pkg1 + required test for PEAR_Installer + + fake package + + PHP License + + + fakeuser + Joe Shmoe + nobody@example.com + lead + + + + 1.0 + 2003-12-11 + stable + + first package + + + + + pkg1file.php + + + randomfile.php + + + + + diff --git a/pear/tests/dirtree/package2.xml b/pear/tests/dirtree/package2.xml new file mode 100644 index 0000000000..c0bde59e4a --- /dev/null +++ b/pear/tests/dirtree/package2.xml @@ -0,0 +1,41 @@ + + + + pkg2 + required test for PEAR_Installer + + fake package + + PHP License + + + fakeuser + Joe Shmoe + nobody@example.com + lead + + + + 1.0 + 2003-12-11 + stable + + second package + + + + + pkg2file.php + + + rootfile.php + + + nestedfile.php + + + + + + + diff --git a/pear/tests/dirtree/pkg1-1.0.tgz b/pear/tests/dirtree/pkg1-1.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..ab305f74a885c22cd0556e2676bba8ed8890a084 GIT binary patch literal 560 zcmV-00?+*)iwFP!000003+z?jZ`v>r?laQ<2hZ=|I5bH&8F$l$v{svnMqesbnhY^u z;l!C^ruM(zImQflnYI<}g-=SjUp}9|JBLQh*J3FLPnEtn6=;&=d5$iSM{@Lw5WUPP zLPe41G$}Hgf+q#s*CvruXA72(O%L-V)MCVF%5s8Pw8|(v@Tz*Y|m0eOz|1AAi+D zh}EK!yjd?PBc0e8+f7vo`^>HUzEM_|$jR2Bg|TQde*g8`P2D=7wX}@H$ZlCF+qqSZ zgDv<%tYs{hk$q1WS_xG5%@0kW)(1NEn&=S5-7W%SdIT%C0 zLTRa0>vl)=2ILPp!Z0Zq&ENnkG_q87gnf%K@+^*Uwb4!iW!uc{qaP5Tzz-QFf0fgx zc(kG}O?8}!k^O3+6_H*R2buT&_l137csBg)B*#>feX9R$kKcU%JH>zhv!ck-4E_sf yS`5K|#_6%^zZb~iwRovL{-FQGFw3F;A^war&NwZ80ssL2{{sLPXhfj^3;+NLFb}l= literal 0 HcmV?d00001 diff --git a/pear/tests/dirtree/pkg2-1.0.tgz b/pear/tests/dirtree/pkg2-1.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..18bc9d2f48ce582505f0328572c5207eae22948f GIT binary patch literal 608 zcmV-m0-yaKiwFP!000003+z^3kJ>N{zh|UHvK)G>=X(UoM5bA}7t7=hL0Spp?G8Gjj*ua@W339SjjjOO^B<*2hOt0^UxMAVSTGTp;$ zrPgAe<&bB!-ksG5h&koZ!&dRg3{Q~RN~W0_dZxx6F)$9jVx8*@G242sr=~-U1Jh+5 z{VSg(@{lSi_0+sx&l?n#-k`zM%J$r82u=?{!IHZ&a(7`w=Re(lgQvNj^b~1&i1fe3 zcwzoG3p4)*5srT}BrJ&fsBh`=w5$KVkLls9c#Rn6)IaRw|37093&?APZs`U3Q~li> uqq{jqkLTE#G0v%f#LWE +--FILE-- + $server, + 'preferred_state' => 'stable', + 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', + 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', + 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', + 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', + 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', + 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', + 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); +touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); +$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); +fwrite($fp, $config); +fclose($fp); +touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); +$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); +fwrite($fp, $config); +fclose($fp); + +putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); +$home = getenv('HOME'); +if (!empty($home)) { + // for PEAR_Config initialization + putenv('HOME="'.$temp_path); +} +require_once "PEAR/Downloader.php"; + +// no UI is needed for these tests +$ui = false; +$curdir = getcwd(); +chdir(dirname(__FILE__)); + +PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); +$error_to_catch = false; +function catchit($err) +{ + global $error_to_catch; + if ($error_to_catch) { + if ($err->getMessage() == $error_to_catch) { + $error_to_catch = false; + echo "Caught expected error\n"; + return; + } + } + echo "Caught error: " . $err->getMessage() . "\n"; +} + +$config = &PEAR_Config::singleton(); +$options = array(); +$installer = &new PEAR_Downloader($ui, $options, $config); + +echo "-=-=-=-=-=-=-=-=- Failure Tests -=-=-=-=-=-=-=-=-=-=-\n"; + +echo "Test invalid package name:\n"; +$packages = array("/invalid+packagename"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages); + +echo "Test download of a package with no releases:\n"; +$packages = array("noreleases"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages); + +echo "Test download of a non-existing package version:\n"; +$packages = array("pkg1-1976.9.2"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages); + +echo "Test download of a non-existing package release state:\n"; +$packages = array("pkg1-snapshot"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages); + +echo "Test download of invalid release state:\n"; +$packages = array("pkg1-burgerking"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages); + +$installer->configSet('preferred_state', 'stable'); + +echo "Test automatic version resolution (stable):\n"; +$packages = array("stabilitytoolow"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages); + +echo "Test automatic version resolution (stable) with --force:\n"; +$packages = array("stabilitytoolow"); +$installer->setOptions(array('force' => true)); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages[0]['info']['version']); + +$installer->configSet('preferred_state', 'beta'); + +echo "Test automatic version resolution (beta):\n"; +$packages = array("stabilitytoolow"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages[0]['info']['version']); + +$installer->configSet('preferred_state', 'alpha'); + +echo "Test automatic version resolution (alpha):\n"; +$packages = array("stabilitytoolow"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages[0]['info']['version']); + +$installer->configSet('preferred_state', 'devel'); + +echo "Test automatic version resolution (devel):\n"; +$packages = array("stabilitytoolow"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs(), $installpackages[0]['info']['version']); + +echo "Test download attempt if a version is already installed:\n"; + +require_once 'PEAR/Installer.php'; +$install = &new PEAR_Installer($ui); +$installer->setOptions(array()); + +$installer->download(array('pkg6')); +$pkgs = $installer->getDownloadedPackages(); +$install->install($pkgs[0]['file']); +$installer->download(array('pkg6')); +var_dump(get_class($a), $installer->getErrorMsgs()); + +echo "Test download attempt if a version is already installed with --force:\n"; + +$installer->setOptions(array('force' => true)); + +$installer->download(array('pkg6')); +$pkgs = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs(), $pkgs[0]['info']['version']); + +echo "Test download attempt if a version is already installed with upgrade, same version:\n"; + +$installer->setOptions(array('upgrade' => true)); + +$installer->download(array('pkg6')); +$pkgs = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs()); + +echo "Test download attempt if a version is already installed with upgrade, lesser version:\n"; + +$installer->setOptions(array('upgrade' => true)); + +$installer->download(array('pkg6-1.1')); +$pkgs = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs()); + +echo "Test download attempt with --alldeps, but dependency has no releases:\n"; + +$installer->setOptions(array('alldeps' => true)); + +$installer->download(array('depnoreleases')); +$pkgs = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs()); + +echo "Test download attempt with --onlyreqdeps, but dependency has no releases:\n"; + +$installer->setOptions(array('onlyreqdeps' => true)); + +$installer->download(array('depnoreleases')); +$pkgs = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs()); + +$installer->configSet('preferred_state', 'stable'); +echo "Test download attempt with --alldeps, but dependency is too unstable:\n"; +$installer->setOptions(array('alldeps' => true)); + +$installer->download(array('depunstable')); +$pkgs = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs()); + +echo "Test download attempt with --onlyreqdeps, but dependency is too unstable:\n"; + +$installer->setOptions(array('onlyreqdeps' => true)); + +$installer->download(array('depunstable')); +$pkgs = $installer->getDownloadedPackages(); +var_dump(get_class($a), $installer->getErrorMsgs()); + +chdir($curdir); +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); +} +?> +--GET-- +--POST-- +--EXPECT-- +-=-=-=-=-=-=-=-=- Failure Tests -=-=-=-=-=-=-=-=-=-=- +Test invalid package name: +Caught error: Package name '/invalid+packagename' not valid +string(10) "pear_error" +array(0) { +} +array(0) { +} +Test download of a package with no releases: +Caught error: No releases found for package 'noreleases' +string(10) "pear_error" +array(0) { +} +array(0) { +} +Test download of a non-existing package version: +Caught error: No release with version '1976.9.2' found for 'pkg1' +string(10) "pear_error" +array(0) { +} +array(0) { +} +Test download of a non-existing package release state: +Caught error: No release with state 'snapshot' found for 'pkg1' +string(10) "pear_error" +array(0) { +} +array(0) { +} +Test download of invalid release state: +Caught error: Invalid postfix '-burgerking', be sure to pass a valid PEAR version number or release state +string(10) "pear_error" +array(0) { +} +array(0) { +} +Test automatic version resolution (stable): +Caught error: No release with state equal to: 'stable' found for 'stabilitytoolow' +string(10) "pear_error" +array(0) { +} +array(0) { +} +Test automatic version resolution (stable) with --force: +Warning: stabilitytoolow is state 'devel' which is less stable than state 'stable' +bool(false) +array(0) { +} +string(6) "3.0dev" +Test automatic version resolution (beta): +bool(false) +array(0) { +} +string(5) "1.0b1" +Test automatic version resolution (alpha): +bool(false) +array(0) { +} +string(5) "2.0a1" +Test automatic version resolution (devel): +bool(false) +array(0) { +} +string(6) "3.0dev" +Test download attempt if a version is already installed: +Package 'pkg6' already installed, skipping +bool(false) +array(0) { +} +Test download attempt if a version is already installed with --force: +bool(false) +array(0) { +} +string(5) "2.0b1" +Test download attempt if a version is already installed with upgrade, same version: +Package 'pkg6-2.0b1' already installed, skipping +bool(false) +array(0) { +} +Test download attempt if a version is already installed with upgrade, lesser version: +Package 'pkg6' version '2.0b1' is installed and 2.0b1 is > requested '1.1', skipping +bool(false) +array(0) { +} +Test download attempt with --alldeps, but dependency has no releases: +bool(false) +array(1) { + [0]=> + string(63) "Package 'depnoreleases' dependency 'noreleases' has no releases" +} +Test download attempt with --onlyreqdeps, but dependency has no releases: +bool(false) +array(1) { + [0]=> + string(63) "Package 'depnoreleases' dependency 'noreleases' has no releases" +} +Test download attempt with --alldeps, but dependency is too unstable: +bool(false) +array(1) { + [0]=> + string(91) "Release for 'depunstable' dependency 'stabilitytoolow' has state 'devel', requires 'stable'" +} +Test download attempt with --onlyreqdeps, but dependency is too unstable: +bool(false) +array(1) { + [0]=> + string(91) "Release for 'depunstable' dependency 'stabilitytoolow' has state 'devel', requires 'stable'" +} \ No newline at end of file diff --git a/pear/tests/pear_downloader_new.phpt b/pear/tests/pear_downloader_new.phpt new file mode 100644 index 0000000000..4d6e8c78f5 --- /dev/null +++ b/pear/tests/pear_downloader_new.phpt @@ -0,0 +1,570 @@ +--TEST-- +PEAR_Downloader::download() test +--SKIPIF-- + +--FILE-- + $server, + 'preferred_state' => 'stable', + 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', + 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', + 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', + 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', + 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', + 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', + 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); +touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); +$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); +fwrite($fp, $config); +fclose($fp); +touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); +$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); +fwrite($fp, $config); +fclose($fp); + +putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); +$home = getenv('HOME'); +if (!empty($home)) { + // for PEAR_Config initialization + putenv('HOME="'.$temp_path); +} +require_once "PEAR/Downloader.php"; + +// no UI is needed for these tests +$ui = false; +$curdir = getcwd(); +chdir(dirname(__FILE__)); + +PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); +$error_to_catch = false; +function catchit($err) +{ + global $error_to_catch; + if ($error_to_catch) { + if ($err->getMessage() == $error_to_catch) { + $error_to_catch = false; + echo "Caught expected error\n"; + return; + } + } + echo "Caught error: " . $err->getMessage() . "\n"; +} + +echo "Test simple direct url download:\n"; + +$config = &PEAR_Config::singleton(); +$packages = array("http://$server/get/pkg6-1.1.tgz"); +$options = array(); +$installer = &new PEAR_Downloader($ui, $options, $config); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); +unset($installpackages[0]['file']); +var_dump($installpackages); + +echo "Test simple package name download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6'); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); +unset($installpackages[0]['file']); +var_dump($installpackages); + +echo "Test package name with version download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6-1.1'); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); + +echo "Test package name with state stable download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6-stable'); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); + +echo "Test package name with state beta download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6-beta'); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-2.0b1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); + +echo "================\nTest preferred_state = beta\n"; +$installer->configSet('preferred_state', 'beta'); + +echo "Test simple package name download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6'); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-2.0b1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); +unset($installpackages[0]['file']); + +echo "\n================Test --alldeps\nTest preferred_state = stable\n"; +$installer->configSet('preferred_state', 'stable'); + +$installer = &new PEAR_Downloader($ui, array('alldeps' => true), $config); +$packages = array("http://$server/get/pkg1-1.1.tgz"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} +$packages = array("pkg1"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} + +echo "Test preferred_state = beta:\n"; +$installer->configSet('preferred_state', 'beta'); + +$packages = array("pkg1"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} + +echo "Test preferred_state = alpha:\n"; +$installer->configSet('preferred_state', 'alpha'); + +$packages = array("pkg1"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} +echo "\n================Test --onlyreqdeps\nTest preferred_state = stable\n"; +$config->set('preferred_state', 'stable'); + +$installer = &new PEAR_Downloader($ui, array('onlyreqdeps' => true), $config); +$packages = array("http://$server/get/pkg1-1.1.tgz"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} +$packages = array("pkg1"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} + +echo "Test preferred_state = beta:\n"; +$installer->configSet('preferred_state', 'beta'); + +$packages = array("pkg1"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} + +echo "Test preferred_state = alpha:\n"; +$installer->configSet('preferred_state', 'alpha'); + +$packages = array("pkg1"); +$a = $installer->download($packages); +$installpackages = $installer->getDownloadedPackages(); +var_dump($a, $installer->getErrorMsgs()); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} + + +chdir($curdir); +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); +} +?> +--GET-- +--POST-- +--EXPECT-- +Test simple direct url download: +NULL +array(0) { +} +File exists? yes +File is the same? yes +array(1) { + [0]=> + array(2) { + ["pkg"]=> + string(4) "pkg6" + ["info"]=> + array(11) { + ["provides"]=> + array(0) { + } + ["filelist"]=> + &array(3) { + ["zoorb.php"]=> + array(2) { + ["role"]=> + string(3) "php" + ["baseinstalldir"]=> + string(5) "groob" + } + ["goompness\oggbrzitzkee.php"]=> + array(2) { + ["role"]=> + string(3) "php" + ["baseinstalldir"]=> + string(5) "groob" + } + ["goompness\Mopreeb.php"]=> + array(2) { + ["role"]=> + string(3) "php" + ["baseinstalldir"]=> + string(5) "groob" + } + } + ["package"]=> + string(4) "pkg6" + ["summary"]=> + string(32) "required test for PEAR_Installer" + ["description"]=> + string(12) "fake package" + ["maintainers"]=> + array(1) { + [0]=> + &array(4) { + ["handle"]=> + string(8) "fakeuser" + ["name"]=> + string(9) "Joe Shmoe" + ["email"]=> + string(18) "nobody@example.com" + ["role"]=> + string(4) "lead" + } + } + ["version"]=> + string(3) "1.1" + ["release_date"]=> + string(10) "2003-09-09" + ["release_license"]=> + string(11) "PHP License" + ["release_state"]=> + string(6) "stable" + ["release_notes"]=> + string(24) "required dependency test" + } + } +} +Test simple package name download: +NULL +array(0) { +} +File exists? yes +File is the same? yes +array(1) { + [0]=> + array(2) { + ["pkg"]=> + string(4) "pkg6" + ["info"]=> + array(11) { + ["provides"]=> + array(0) { + } + ["filelist"]=> + &array(3) { + ["zoorb.php"]=> + array(2) { + ["role"]=> + string(3) "php" + ["baseinstalldir"]=> + string(5) "groob" + } + ["goompness\oggbrzitzkee.php"]=> + array(2) { + ["role"]=> + string(3) "php" + ["baseinstalldir"]=> + string(5) "groob" + } + ["goompness\Mopreeb.php"]=> + array(2) { + ["role"]=> + string(3) "php" + ["baseinstalldir"]=> + string(5) "groob" + } + } + ["package"]=> + string(4) "pkg6" + ["summary"]=> + string(32) "required test for PEAR_Installer" + ["description"]=> + string(12) "fake package" + ["maintainers"]=> + array(1) { + [0]=> + &array(4) { + ["handle"]=> + string(8) "fakeuser" + ["name"]=> + string(9) "Joe Shmoe" + ["email"]=> + string(18) "nobody@example.com" + ["role"]=> + string(4) "lead" + } + } + ["version"]=> + string(3) "1.1" + ["release_date"]=> + string(10) "2003-09-09" + ["release_license"]=> + string(11) "PHP License" + ["release_state"]=> + string(6) "stable" + ["release_notes"]=> + string(24) "required dependency test" + } + } +} +Test package name with version download: +NULL +array(0) { +} +File exists? yes +File is the same? yes +Test package name with state stable download: +NULL +array(0) { +} +File exists? yes +File is the same? yes +Test package name with state beta download: +NULL +array(0) { +} +File exists? yes +File is the same? yes +================ +Test preferred_state = beta +Test simple package name download: +NULL +array(0) { +} +File exists? yes +File is the same? yes + +================Test --alldeps +Test preferred_state = stable +NULL +array(0) { +} +Packages downloaded and version: +pkg1-1.1 +pkg2-1.1 +pkg3-1.1 +pkg4-1.1 +pkg5-1.1 +pkg6-1.1 +NULL +array(0) { +} +Packages downloaded and version: +pkg1-1.1 +pkg2-1.1 +pkg3-1.1 +pkg4-1.1 +pkg5-1.1 +pkg6-1.1 +Test preferred_state = beta: +NULL +array(0) { +} +Packages downloaded and version: +pkg1-2.0b1 +pkg2-1.1 +pkg3-1.1 +pkg4-1.1 +pkg5-1.1 +pkg6-2.0b1 +Test preferred_state = alpha: +NULL +array(0) { +} +Packages downloaded and version: +pkg1-2.0b1 +pkg2-1.1 +pkg3-1.4 +pkg4AndAHalf-1.3 +pkg4-1.1 +pkg5-1.1 +pkg6-2.0b1 + +================Test --onlyreqdeps +Test preferred_state = stable +NULL +array(0) { +} +Packages downloaded and version: +pkg1-1.1 +pkg2-1.1 +pkg3-1.1 +pkg4-1.1 +pkg5-1.1 +pkg6-1.1 +NULL +array(0) { +} +Packages downloaded and version: +pkg1-1.1 +pkg2-1.1 +pkg3-1.1 +pkg4-1.1 +pkg5-1.1 +pkg6-1.1 +Test preferred_state = beta: +NULL +array(0) { +} +Packages downloaded and version: +pkg1-2.0b1 +pkg2-1.1 +pkg3-1.1 +pkg4-1.1 +pkg5-1.1 +pkg6-2.0b1 +Test preferred_state = alpha: +skipping Package 'pkg3' optional dependency 'pkg4AndAHalf' +NULL +array(0) { +} +Packages downloaded and version: +pkg1-2.0b1 +pkg2-1.1 +pkg3-1.4 +pkg4-1.1 +pkg5-1.1 +pkg6-2.0b1 \ No newline at end of file diff --git a/pear/tests/pear_downloader_old.phpt b/pear/tests/pear_downloader_old.phpt new file mode 100644 index 0000000000..381dfca9da --- /dev/null +++ b/pear/tests/pear_downloader_old.phpt @@ -0,0 +1,598 @@ +--TEST-- +PEAR_Installer test: PEAR_Installer::download() (deprecated) +--SKIPIF-- + +--FILE-- + $server, + 'preferred_state' => 'stable', + 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', + 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', + 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', + 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', + 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', + 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', + 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); +touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); +$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); +fwrite($fp, $config); +fclose($fp); +touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); +$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); +fwrite($fp, $config); +fclose($fp); + +putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); +$home = getenv('HOME'); +if (!empty($home)) { + // for PEAR_Config initialization + putenv('HOME="'.$temp_path); +} +require_once "PEAR/Installer.php"; + +// no UI is needed for these tests +$ui = false; +$installer = new PEAR_Installer($ui); +$curdir = getcwd(); +chdir(dirname(__FILE__)); + +PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); +set_error_handler('catchphp'); + +function catchphp($errno, $errmsg) +{ + if (error_reporting() == 0) { + return; + } + $errlevel = array( + E_USER_NOTICE => 'Notice', + E_USER_WARNING => 'Warning', + E_USER_ERROR => 'Error', + E_WARNING => 'Warning', + E_NOTICE => 'Notice' + ); + echo $errlevel[$errno] . ': ' . $errmsg . "\n"; +} +$error_to_catch = false; +function catchit($err) +{ + global $error_to_catch; + if ($error_to_catch) { + if ($err->getMessage() == $error_to_catch) { + $error_to_catch = false; + echo "Caught expected error\n"; + return; + } + } + echo "Caught error: " . $err->getMessage() . "\n"; +} + +echo "Test simple direct url download:\n"; + +$config = &PEAR_Config::singleton(); +$packages = array("http://$server/get/pkg6-1.1.tgz"); +$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); +var_dump($a, $errors); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); +unset($installpackages[0]['file']); +var_dump($installpackages); + +echo "Test simple package name download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6'); +$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); +var_dump($a, $errors); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); +unset($installpackages[0]['file']); +var_dump($installpackages); + +echo "Test package name with version download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6-1.1'); +$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); +var_dump($a, $errors); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); + +echo "Test package name with state stable download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6-stable'); +$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); +var_dump($a, $errors); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); + +echo "Test package name with state beta download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6-beta'); +$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); +var_dump($a, $errors); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-2.0b1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); + +echo "================\nTest preferred_state = beta\n"; +$config->set('preferred_state', 'beta'); + +echo "Test simple package name download:\n"; +$installpackages = $errors = array(); +$packages = array('pkg6'); +$a = $installer->download($packages, array(), &$config, &$installpackages, &$errors); +var_dump($a, $errors); + +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-2.0b1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); +unset($installpackages[0]['file']); + +echo "\n================Test --alldeps\nTest preferred_state = stable\n"; +$config->set('preferred_state', 'stable'); + +$config = &PEAR_Config::singleton(); +$packages = array("http://$server/get/pkg1-1.1.tgz"); +$a = $installer->download($packages, array('alldeps' => true), &$config, &$installpackages, &$errors); +var_dump($a, $errors); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} +$packages = array("pkg1"); +$a = $installer->download($packages, array('alldeps' => true), &$config, &$installpackages, &$errors); +var_dump($a, $errors); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} + +echo "Test preferred_state = beta:\n"; +$config->set('preferred_state', 'beta'); + +$config = &PEAR_Config::singleton(); +$packages = array("pkg1"); +$a = $installer->download($packages, array('alldeps' => true), &$config, &$installpackages, &$errors); +var_dump($a, $errors); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} + +echo "Test preferred_state = alpha:\n"; +$config->set('preferred_state', 'alpha'); + +$config = &PEAR_Config::singleton(); +$packages = array("pkg1"); +$a = $installer->download($packages, array('alldeps' => true), &$config, &$installpackages, &$errors); +var_dump($a, $errors); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} +echo "\n================Test --onlyreqdeps\nTest preferred_state = stable\n"; +$config->set('preferred_state', 'stable'); + +$config = &PEAR_Config::singleton(); +$packages = array("http://$server/get/pkg1-1.1.tgz"); +$a = $installer->download($packages, array('onlyreqdeps' => true), &$config, &$installpackages, &$errors); +var_dump($a, $errors); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} +$packages = array("pkg1"); +$a = $installer->download($packages, array('onlyreqdeps' => true), &$config, &$installpackages, &$errors); +var_dump($a, $errors); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} + +echo "Test preferred_state = beta:\n"; +$config->set('preferred_state', 'beta'); + +$config = &PEAR_Config::singleton(); +$packages = array("pkg1"); +$a = $installer->download($packages, array('onlyreqdeps' => true), &$config, &$installpackages, &$errors); +var_dump($a, $errors); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} + +echo "Test preferred_state = alpha:\n"; +$config->set('preferred_state', 'alpha'); + +$config = &PEAR_Config::singleton(); +$packages = array("pkg1"); +$a = $installer->download($packages, array('onlyreqdeps' => true), &$config, &$installpackages, &$errors); +var_dump($a, $errors); +echo "Packages downloaded and version:\n"; +foreach ($installpackages as $package) { + echo $package['pkg'] . '-' . $package['info']['version'] . "\n"; +} + + +chdir($curdir); +cleanall($temp_path); +/* +echo "File exists? "; +echo (is_file($installpackages[0]['file'])) ? "yes\n" : "no\n"; +echo "File is the same? "; +$good = implode('', file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz')); +$dled = implode('', file($installpackages[0]['file'])); +echo ($good == $dled) ? "yes\n" : "no\n"; +unlink($installpackages[0]['file']); +unset($installpackages[0]['file']);*/ +// ------------------------------------------------------------------------- // + +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); +} +?> +--GET-- +--POST-- +--EXPECT-- +Test simple direct url download: +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +File exists? yes +File is the same? yes +array(1) { + [0]=> + array(2) { + ["pkg"]=> + string(4) "pkg6" + ["info"]=> + array(11) { + ["provides"]=> + array(0) { + } + ["filelist"]=> + &array(3) { + ["zoorb.php"]=> + array(2) { + ["role"]=> + string(3) "php" + ["baseinstalldir"]=> + string(5) "groob" + } + ["goompness\oggbrzitzkee.php"]=> + array(2) { + ["role"]=> + string(3) "php" + ["baseinstalldir"]=> + string(5) "groob" + } + ["goompness\Mopreeb.php"]=> + array(2) { + ["role"]=> + string(3) "php" + ["baseinstalldir"]=> + string(5) "groob" + } + } + ["package"]=> + string(4) "pkg6" + ["summary"]=> + string(32) "required test for PEAR_Installer" + ["description"]=> + string(12) "fake package" + ["maintainers"]=> + array(1) { + [0]=> + &array(4) { + ["handle"]=> + string(8) "fakeuser" + ["name"]=> + string(9) "Joe Shmoe" + ["email"]=> + string(18) "nobody@example.com" + ["role"]=> + string(4) "lead" + } + } + ["version"]=> + string(3) "1.1" + ["release_date"]=> + string(10) "2003-09-09" + ["release_license"]=> + string(11) "PHP License" + ["release_state"]=> + string(6) "stable" + ["release_notes"]=> + string(24) "required dependency test" + } + } +} +Test simple package name download: +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +File exists? yes +File is the same? yes +array(1) { + [0]=> + array(2) { + ["pkg"]=> + string(4) "pkg6" + ["info"]=> + array(11) { + ["provides"]=> + array(0) { + } + ["filelist"]=> + &array(3) { + ["zoorb.php"]=> + array(2) { + ["role"]=> + string(3) "php" + ["baseinstalldir"]=> + string(5) "groob" + } + ["goompness\oggbrzitzkee.php"]=> + array(2) { + ["role"]=> + string(3) "php" + ["baseinstalldir"]=> + string(5) "groob" + } + ["goompness\Mopreeb.php"]=> + array(2) { + ["role"]=> + string(3) "php" + ["baseinstalldir"]=> + string(5) "groob" + } + } + ["package"]=> + string(4) "pkg6" + ["summary"]=> + string(32) "required test for PEAR_Installer" + ["description"]=> + string(12) "fake package" + ["maintainers"]=> + array(1) { + [0]=> + &array(4) { + ["handle"]=> + string(8) "fakeuser" + ["name"]=> + string(9) "Joe Shmoe" + ["email"]=> + string(18) "nobody@example.com" + ["role"]=> + string(4) "lead" + } + } + ["version"]=> + string(3) "1.1" + ["release_date"]=> + string(10) "2003-09-09" + ["release_license"]=> + string(11) "PHP License" + ["release_state"]=> + string(6) "stable" + ["release_notes"]=> + string(24) "required dependency test" + } + } +} +Test package name with version download: +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +File exists? yes +File is the same? yes +Test package name with state stable download: +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +File exists? yes +File is the same? yes +Test package name with state beta download: +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +File exists? yes +File is the same? yes +================ +Test preferred_state = beta +Test simple package name download: +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +File exists? yes +File is the same? yes + +================Test --alldeps +Test preferred_state = stable +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +Packages downloaded and version: +pkg1-1.1 +pkg2-1.1 +pkg3-1.1 +pkg4-1.1 +pkg5-1.1 +pkg6-1.1 +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +Packages downloaded and version: +pkg1-1.1 +pkg2-1.1 +pkg3-1.1 +pkg4-1.1 +pkg5-1.1 +pkg6-1.1 +Test preferred_state = beta: +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +Packages downloaded and version: +pkg1-2.0b1 +pkg2-1.1 +pkg3-1.1 +pkg4-1.1 +pkg5-1.1 +pkg6-2.0b1 +Test preferred_state = alpha: +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +Packages downloaded and version: +pkg1-2.0b1 +pkg2-1.1 +pkg3-1.4 +pkg4AndAHalf-1.3 +pkg4-1.1 +pkg5-1.1 +pkg6-2.0b1 + +================Test --onlyreqdeps +Test preferred_state = stable +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +Packages downloaded and version: +pkg1-1.1 +pkg2-1.1 +pkg3-1.1 +pkg4-1.1 +pkg5-1.1 +pkg6-1.1 +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +Packages downloaded and version: +pkg1-1.1 +pkg2-1.1 +pkg3-1.1 +pkg4-1.1 +pkg5-1.1 +pkg6-1.1 +Test preferred_state = beta: +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +Packages downloaded and version: +pkg1-2.0b1 +pkg2-1.1 +pkg3-1.1 +pkg4-1.1 +pkg5-1.1 +pkg6-2.0b1 +Test preferred_state = alpha: +skipping Package 'pkg3' optional dependency 'pkg4AndAHalf' +Warning: PEAR Warning: PEAR_Installer::download() is deprecated in favor of PEAR_Downloader class +NULL +array(0) { +} +Packages downloaded and version: +pkg1-2.0b1 +pkg2-1.1 +pkg3-1.4 +pkg4-1.1 +pkg5-1.1 +pkg6-2.0b1 \ No newline at end of file diff --git a/pear/tests/pear_installer5.phpt b/pear/tests/pear_installer5.phpt new file mode 100644 index 0000000000..77415b9641 --- /dev/null +++ b/pear/tests/pear_installer5.phpt @@ -0,0 +1,226 @@ +--TEST-- +PEAR_Installer test #5: test directory tracking/deletion of installation +--SKIPIF-- + +--FILE-- + 'pear.php.net', + 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', + 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', + 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', + 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', + 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', + 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); +touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); +$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); +fwrite($fp, $config); +fclose($fp); +touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); +$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); +fwrite($fp, $config); +fclose($fp); + +putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); +$home = getenv('HOME'); +if (!empty($home)) { + // for PEAR_Config initialization + putenv('HOME="'.$temp_path); +} +require_once "PEAR/Installer.php"; + +// no UI is needed for these tests +$ui = false; +$installer = new PEAR_Installer($ui); +$curdir = getcwd(); +chdir(dirname(__FILE__)); + +PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); + +$error_to_catch = false; +function catchit($err) +{ + global $error_to_catch; + if ($error_to_catch) { + if ($err->getMessage() == $error_to_catch) { + $error_to_catch = false; + echo "Caught expected error\n"; + return; + } + } + echo "Caught error: " . $err->getMessage() . "\n"; +} + +$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . DIRECTORY_SEPARATOR . 'package.xml'); +$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . DIRECTORY_SEPARATOR . 'package2.xml'); +$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); +var_dump($reg->listPackages()); +$info = $reg->packageInfo('pkg1'); +echo "pkg1 dir tree contains test/? "; +echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test'])) ? "yes\n" : "no\n"; +echo "pkg1 dir tree contains test/multiplepackages? "; +echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'multiplepackages'])) ? "yes\n" : "no\n"; +echo "pkg1 dir tree contains test/pkg1? "; +echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'pkg1'])) ? "yes\n" : "no\n"; + +$info = $reg->packageInfo('pkg2'); +echo "pkg2 dir tree contains test/? "; +echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test'])) ? "yes\n" : "no\n"; +echo "pkg2 dir tree contains test/multiplepackages? "; +echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'multiplepackages'])) ? "yes\n" : "no\n"; +echo "pkg2 dir tree contains test/nestedroot? "; +echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot'])) ? "yes\n" : "no\n"; +echo "pkg2 dir tree contains test/nestedroot/emptydir? "; +echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot' + . DIRECTORY_SEPARATOR . 'emptydir'])) ? "yes\n" : "no\n"; +echo "pkg2 dir tree contains test/nestedroot/emptydir/nesteddir? "; +echo (isset($info['filelist']['dirtree'][$temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot' + . DIRECTORY_SEPARATOR . 'emptydir' . DIRECTORY_SEPARATOR . 'nesteddir'])) ? "yes\n" : "no\n"; + +echo "After uninstall of pkg1:\n"; +$installer->uninstall('pkg1'); +echo "test/ exists? "; +echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test')) ? "yes\n" : "no\n"; +echo "test/multiplepackages exists? "; +echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'multiplepackages')) ? "yes\n" : "no\n"; +echo "test/pkg1 exists? "; +echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'pkg1')) ? "yes\n" : "no\n"; +echo "test/nestedroot exists? "; +echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot')) ? "yes\n" : "no\n"; +echo "test/nestedroot/emptydir exists? "; +echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot' + . DIRECTORY_SEPARATOR . 'emptydir')) ? "yes\n" : "no\n"; +echo "test/nestedroot/emptydir/nesteddir exists? "; +echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot' + . DIRECTORY_SEPARATOR . 'emptydir'. DIRECTORY_SEPARATOR . 'nesteddir')) ? "yes\n" : "no\n"; +var_dump($reg->listPackages()); + +echo "After uninstall of pkg2:\n"; +$installer->uninstall('pkg2'); +echo "test/ exists? "; +echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test')) ? "yes\n" : "no\n"; +echo "test/multiplepackages exists? "; +echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'multiplepackages')) ? "yes\n" : "no\n"; +echo "test/pkg1 exists? "; +echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'pkg1')) ? "yes\n" : "no\n"; +echo "test/nestedroot exists? "; +echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot')) ? "yes\n" : "no\n"; +echo "test/nestedroot/emptydir exists? "; +echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot' + . DIRECTORY_SEPARATOR . 'emptydir')) ? "yes\n" : "no\n"; +echo "test/nestedroot/emptydir/nesteddir exists? "; +echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' + . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'nestedroot' + . DIRECTORY_SEPARATOR . 'emptydir'. DIRECTORY_SEPARATOR . 'nesteddir')) ? "yes\n" : "no\n"; +var_dump($reg->listPackages()); + +chdir($curdir); +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); +} +?> +--GET-- +--POST-- +--EXPECT-- +array(2) { + [0]=> + string(4) "pkg1" + [1]=> + string(4) "pkg2" +} +pkg1 dir tree contains test/? yes +pkg1 dir tree contains test/multiplepackages? yes +pkg1 dir tree contains test/pkg1? yes +pkg2 dir tree contains test/? yes +pkg2 dir tree contains test/multiplepackages? yes +pkg2 dir tree contains test/nestedroot? yes +pkg2 dir tree contains test/nestedroot/emptydir? yes +pkg2 dir tree contains test/nestedroot/emptydir/nesteddir? yes +After uninstall of pkg1: +test/ exists? yes +test/multiplepackages exists? yes +test/pkg1 exists? no +test/nestedroot exists? yes +test/nestedroot/emptydir exists? yes +test/nestedroot/emptydir/nesteddir exists? yes +array(1) { + [0]=> + string(4) "pkg2" +} +After uninstall of pkg2: +test/ exists? no +test/multiplepackages exists? no +test/pkg1 exists? no +test/nestedroot exists? no +test/nestedroot/emptydir exists? no +test/nestedroot/emptydir/nesteddir exists? no +array(0) { +} \ No newline at end of file diff --git a/pear/tests/pear_packager.phpt b/pear/tests/pear_packager.phpt new file mode 100644 index 0000000000..9d584b2609 --- /dev/null +++ b/pear/tests/pear_packager.phpt @@ -0,0 +1,432 @@ +--TEST-- +PEAR_Packager test +--SKIPIF-- + +--FILE-- + 'pear.php.net', + 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', + 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', + 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', + 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', + 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', + 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); +touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); +$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); +fwrite($fp, $config); +fclose($fp); +touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); +$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); +fwrite($fp, $config); +fclose($fp); + +putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); +$home = getenv('HOME'); +if (!empty($home)) { + // for PEAR_Config initialization + putenv('HOME="'.$temp_path); +} +require_once "PEAR/Packager.php"; + +$packager = new PEAR_Packager(); +$curdir = getcwd(); +chdir(dirname(__FILE__)); + +PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchit'); + +$error_to_catch = false; +function catchit($err) +{ + global $error_to_catch; + if ($error_to_catch) { + if ($err->getMessage() == $error_to_catch) { + $error_to_catch = false; + echo "Caught expected error\n"; + return; + } + } + echo "Caught error: " . $err->getMessage() . "\n"; +} +ob_start(); +$packager->package(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . DIRECTORY_SEPARATOR . 'package.xml'); +$packager->package(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . DIRECTORY_SEPARATOR . 'package2.xml'); +$stuff = str_replace(array(dirname(__FILE__) . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), array('', '/'), + ob_get_contents()); +ob_end_clean(); +echo $stuff; + +$archive1 = &new Archive_Tar(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg1-1.0.tgz'); +$archive1c = &new Archive_Tar(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . + DIRECTORY_SEPARATOR . 'pkg1-1.0.tgz'); +$x1 = $archive1->listContent(); +$x2 = $archive1c->listContent(); +for($i=0;$ilistContent(); +$x2 = $archive1c->listContent(); +for($i=0;$ipackage(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dirtree' . DIRECTORY_SEPARATOR . 'package-fail.xml'); + +unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg1-1.0.tgz'); +unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pkg2-1.0.tgz'); +chdir($curdir); +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); +} +?> +--GET-- +--POST-- +--EXPECT-- +Analyzing multiplepackages/pkg1file.php +Analyzing pkg1/randomfile.php +Package pkg1-1.0.tgz done +Tag the released code with `pear cvstag package.xml' +(or set the CVS tag RELEASE_1_0 by hand) +Analyzing multiplepackages/pkg2file.php +Analyzing nestedroot/rootfile.php +Analyzing nestedroot/emptydir/nesteddir/nestedfile.php +Package pkg2-1.0.tgz done +Tag the released code with `pear cvstag package2.xml' +(or set the CVS tag RELEASE_1_0 by hand) +array(3) { + [0]=> + array(6) { + ["filename"]=> + string(11) "package.xml" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(817) + ["typeflag"]=> + string(0) "" + } + [1]=> + array(8) { + ["checksum"]=> + int(5592) + ["filename"]=> + string(38) "pkg1-1.0/multiplepackages/pkg1file.php" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(0) + ["mtime"]=> + int(1071119017) + ["typeflag"]=> + string(0) "" + } + [2]=> + array(8) { + ["checksum"]=> + int(4534) + ["filename"]=> + string(28) "pkg1-1.0/pkg1/randomfile.php" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(0) + ["mtime"]=> + int(1071120110) + ["typeflag"]=> + string(0) "" + } +} +array(3) { + [0]=> + array(6) { + ["filename"]=> + string(11) "package.xml" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(817) + ["typeflag"]=> + string(0) "" + } + [1]=> + array(8) { + ["checksum"]=> + int(5592) + ["filename"]=> + string(38) "pkg1-1.0/multiplepackages/pkg1file.php" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(0) + ["mtime"]=> + int(1071119017) + ["typeflag"]=> + string(0) "" + } + [2]=> + array(8) { + ["checksum"]=> + int(4534) + ["filename"]=> + string(28) "pkg1-1.0/pkg1/randomfile.php" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(0) + ["mtime"]=> + int(1071120110) + ["typeflag"]=> + string(0) "" + } +} +array(4) { + [0]=> + array(6) { + ["filename"]=> + string(11) "package.xml" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(921) + ["typeflag"]=> + string(0) "" + } + [1]=> + array(8) { + ["checksum"]=> + int(5600) + ["filename"]=> + string(38) "pkg2-1.0/multiplepackages/pkg2file.php" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(0) + ["mtime"]=> + int(1071119030) + ["typeflag"]=> + string(0) "" + } + [2]=> + array(8) { + ["checksum"]=> + int(5066) + ["filename"]=> + string(32) "pkg2-1.0/nestedroot/rootfile.php" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(0) + ["mtime"]=> + int(1071119266) + ["typeflag"]=> + string(0) "" + } + [3]=> + array(8) { + ["checksum"]=> + int(7193) + ["filename"]=> + string(53) "pkg2-1.0/nestedroot/emptydir/nesteddir/nestedfile.php" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(0) + ["mtime"]=> + int(1071119310) + ["typeflag"]=> + string(0) "" + } +} +array(4) { + [0]=> + array(6) { + ["filename"]=> + string(11) "package.xml" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(921) + ["typeflag"]=> + string(0) "" + } + [1]=> + array(8) { + ["checksum"]=> + int(5600) + ["filename"]=> + string(38) "pkg2-1.0/multiplepackages/pkg2file.php" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(0) + ["mtime"]=> + int(1071119030) + ["typeflag"]=> + string(0) "" + } + [2]=> + array(8) { + ["checksum"]=> + int(5066) + ["filename"]=> + string(32) "pkg2-1.0/nestedroot/rootfile.php" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(0) + ["mtime"]=> + int(1071119266) + ["typeflag"]=> + string(0) "" + } + [3]=> + array(8) { + ["checksum"]=> + int(7193) + ["filename"]=> + string(53) "pkg2-1.0/nestedroot/emptydir/nesteddir/nestedfile.php" + ["mode"]=> + int(33206) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["size"]=> + int(0) + ["mtime"]=> + int(1071119310) + ["typeflag"]=> + string(0) "" + } +} +test failure: +Analyzing multiplepackages\pkg2file.php +Analyzing nestedroot\rootfile.php +Analyzing nestedroot\emptydir\nesteddir\nestedfile.php +Analyzing nestedroot\emptydir\nesteddir\doesntexist.php +Caught error: File does not exist: nestedroot\emptydir\nesteddir\doesntexist.php \ No newline at end of file -- 2.50.1