From 2e7e8f30fca390837cf3676bff0bd51755d47b08 Mon Sep 17 00:00:00 2001 From: Greg Beaver Date: Sun, 30 May 2004 17:02:34 +0000 Subject: [PATCH] fix unit tests for 1.4.0dev3 --- pear/tests/pear_channelfile.phpt | 326 +++++++++--------- pear/tests/pear_dependency_checkPackage.phpt | 28 +- pear/tests/pear_installer4.phpt | 2 +- .../pear_installer_install_channels.phpt | 190 ++++------ pear/tests/pear_packager.phpt | 4 +- pear/tests/pear_registry.phpt | 14 - 6 files changed, 253 insertions(+), 311 deletions(-) diff --git a/pear/tests/pear_channelfile.phpt b/pear/tests/pear_channelfile.phpt index 826892eda7..838c57fbcb 100644 --- a/pear/tests/pear_channelfile.phpt +++ b/pear/tests/pear_channelfile.phpt @@ -139,20 +139,8 @@ bool(true) array(6) { ["version"]=> string(3) "1.0" - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } ["name"]=> - string(5) "PEAR5" + string(5) "pear5" ["summary"]=> string(23) "PEAR packages for PHP 5" ["server"]=> @@ -162,7 +150,7 @@ array(6) { [1]=> array(4) { ["name"]=> - string(8) "PEAR5.qa" + string(8) "pear5.qa" ["server"]=> string(15) "qa.pear.php.net" ["summary"]=> @@ -224,15 +212,27 @@ array(6) { } } } + ["deps"]=> + array(1) { + [1]=> + array(3) { + ["type"]=> + string(3) "php" + ["rel"]=> + string(2) "ge" + ["version"]=> + string(5) "5.0.0" + } + } } string(823) " - PEAR5 + pear5 PEAR packages for PHP 5 pear.php.net - + Quality Assurance releases of unmaintained packages PEAR @@ -257,20 +257,8 @@ bool(true) array(6) { ["version"]=> string(3) "1.0" - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } ["name"]=> - string(5) "PEAR5" + string(5) "pear5" ["summary"]=> string(23) "PEAR packages for PHP 5" ["server"]=> @@ -280,7 +268,7 @@ array(6) { [1]=> array(4) { ["name"]=> - string(8) "PEAR5.qa" + string(8) "pear5.qa" ["server"]=> string(15) "qa.pear.php.net" ["summary"]=> @@ -342,15 +330,27 @@ array(6) { } } } + ["deps"]=> + array(1) { + [1]=> + array(3) { + ["type"]=> + string(3) "php" + ["rel"]=> + string(2) "ge" + ["version"]=> + string(5) "5.0.0" + } + } } string(823) " - PEAR5 + pear5 PEAR packages for PHP 5 pear.php.net - + Quality Assurance releases of unmaintained packages PEAR @@ -376,20 +376,8 @@ bool(true) array(6) { ["version"]=> string(3) "1.0" - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } ["name"]=> - string(5) "PEAR5" + string(5) "pear5" ["summary"]=> string(23) "PEAR packages for PHP 5" ["server"]=> @@ -399,7 +387,7 @@ array(6) { [1]=> array(4) { ["name"]=> - string(8) "PEAR5.qa" + string(8) "pear5.qa" ["server"]=> string(15) "qa.pear.php.net" ["summary"]=> @@ -461,15 +449,27 @@ array(6) { } } } + ["deps"]=> + array(1) { + [1]=> + array(3) { + ["type"]=> + string(3) "php" + ["rel"]=> + string(2) "ge" + ["version"]=> + string(5) "5.0.0" + } + } } string(823) " - PEAR5 + pear5 PEAR packages for PHP 5 pear.php.net - + Quality Assurance releases of unmaintained packages PEAR @@ -494,20 +494,8 @@ bool(true) array(6) { ["version"]=> string(3) "1.0" - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } ["name"]=> - string(5) "PEAR5" + string(5) "pear5" ["summary"]=> string(23) "PEAR packages for PHP 5" ["server"]=> @@ -517,7 +505,7 @@ array(6) { [1]=> array(4) { ["name"]=> - string(8) "PEAR5.qa" + string(8) "pear5.qa" ["server"]=> string(15) "qa.pear.php.net" ["summary"]=> @@ -579,15 +567,27 @@ array(6) { } } } + ["deps"]=> + array(1) { + [1]=> + array(3) { + ["type"]=> + string(3) "php" + ["rel"]=> + string(2) "ge" + ["version"]=> + string(5) "5.0.0" + } + } } string(823) " - PEAR5 + pear5 PEAR packages for PHP 5 pear.php.net - + Quality Assurance releases of unmaintained packages PEAR @@ -612,20 +612,8 @@ test add packagenameregex array(7) { ["version"]=> string(3) "1.0" - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } ["name"]=> - string(5) "PEAR5" + string(5) "pear5" ["summary"]=> string(23) "PEAR packages for PHP 5" ["server"]=> @@ -635,7 +623,7 @@ array(7) { [1]=> array(4) { ["name"]=> - string(8) "PEAR5.qa" + string(8) "pear5.qa" ["server"]=> string(15) "qa.pear.php.net" ["summary"]=> @@ -697,18 +685,30 @@ array(7) { } } } + ["deps"]=> + array(1) { + [1]=> + array(3) { + ["type"]=> + string(3) "php" + ["rel"]=> + string(2) "ge" + ["version"]=> + string(5) "5.0.0" + } + } ["packagenameregex"]=> string(6) "[A-Z]+" } string(868) " - PEAR5 + pear5 PEAR packages for PHP 5 pear.php.net [A-Z]+ - + Quality Assurance releases of unmaintained packages PEAR @@ -733,20 +733,8 @@ bool(true) array(7) { ["version"]=> string(3) "1.0" - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } ["name"]=> - string(5) "PEAR5" + string(5) "pear5" ["summary"]=> string(23) "PEAR packages for PHP 5" ["server"]=> @@ -758,7 +746,7 @@ array(7) { [1]=> array(4) { ["name"]=> - string(8) "PEAR5.qa" + string(8) "pear5.qa" ["server"]=> string(15) "qa.pear.php.net" ["summary"]=> @@ -820,16 +808,28 @@ array(7) { } } } + ["deps"]=> + array(1) { + [1]=> + array(3) { + ["type"]=> + string(3) "php" + ["rel"]=> + string(2) "ge" + ["version"]=> + string(5) "5.0.0" + } + } } string(868) " - PEAR5 + pear5 PEAR packages for PHP 5 pear.php.net [A-Z]+ - + Quality Assurance releases of unmaintained packages PEAR @@ -854,20 +854,8 @@ test add protocols array(8) { ["version"]=> string(3) "1.0" - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } ["name"]=> - string(5) "PEAR5" + string(5) "pear5" ["summary"]=> string(23) "PEAR packages for PHP 5" ["server"]=> @@ -879,7 +867,7 @@ array(8) { [1]=> array(4) { ["name"]=> - string(8) "PEAR5.qa" + string(8) "pear5.qa" ["server"]=> string(15) "qa.pear.php.net" ["summary"]=> @@ -941,6 +929,18 @@ array(8) { } } } + ["deps"]=> + array(1) { + [1]=> + array(3) { + ["type"]=> + string(3) "php" + ["rel"]=> + string(2) "ge" + ["version"]=> + string(5) "5.0.0" + } + } ["provides"]=> array(3) { [1]=> @@ -973,7 +973,7 @@ array(8) { string(1065) " - PEAR5 + pear5 PEAR packages for PHP 5 pear.php.net @@ -983,7 +983,7 @@ string(1065) " [A-Z]+ - + Quality Assurance releases of unmaintained packages PEAR @@ -1008,20 +1008,8 @@ bool(true) array(8) { ["version"]=> string(3) "1.0" - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } ["name"]=> - string(5) "PEAR5" + string(5) "pear5" ["summary"]=> string(23) "PEAR packages for PHP 5" ["server"]=> @@ -1061,7 +1049,7 @@ array(8) { [1]=> array(4) { ["name"]=> - string(8) "PEAR5.qa" + string(8) "pear5.qa" ["server"]=> string(15) "qa.pear.php.net" ["summary"]=> @@ -1123,11 +1111,23 @@ array(8) { } } } + ["deps"]=> + array(1) { + [1]=> + array(3) { + ["type"]=> + string(3) "php" + ["rel"]=> + string(2) "ge" + ["version"]=> + string(5) "5.0.0" + } + } } string(1065) " - PEAR5 + pear5 PEAR packages for PHP 5 pear.php.net @@ -1137,7 +1137,7 @@ string(1065) " [A-Z]+ - + Quality Assurance releases of unmaintained packages PEAR @@ -1162,20 +1162,8 @@ test add mirror array(9) { ["version"]=> string(3) "1.0" - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } ["name"]=> - string(5) "PEAR5" + string(5) "pear5" ["summary"]=> string(23) "PEAR packages for PHP 5" ["server"]=> @@ -1215,7 +1203,7 @@ array(9) { [1]=> array(4) { ["name"]=> - string(8) "PEAR5.qa" + string(8) "pear5.qa" ["server"]=> string(15) "qa.pear.php.net" ["summary"]=> @@ -1277,6 +1265,18 @@ array(9) { } } } + ["deps"]=> + array(1) { + [1]=> + array(3) { + ["type"]=> + string(3) "php" + ["rel"]=> + string(2) "ge" + ["version"]=> + string(5) "5.0.0" + } + } ["mirrors"]=> array(1) { [1]=> @@ -1312,7 +1312,7 @@ array(9) { string(1313) " - PEAR5 + pear5 PEAR packages for PHP 5 pear.php.net @@ -1330,7 +1330,7 @@ string(1313) " - + Quality Assurance releases of unmaintained packages PEAR @@ -1355,20 +1355,8 @@ bool(true) array(9) { ["version"]=> string(3) "1.0" - ["deps"]=> - array(1) { - [1]=> - array(3) { - ["type"]=> - string(3) "php" - ["rel"]=> - string(2) "ge" - ["version"]=> - string(5) "5.0.0" - } - } ["name"]=> - string(5) "PEAR5" + string(5) "pear5" ["summary"]=> string(23) "PEAR packages for PHP 5" ["server"]=> @@ -1402,7 +1390,7 @@ array(9) { } } ["packagenameregex"]=> - string(12) "release.list" + string(6) "[A-Z]+" ["mirrors"]=> array(1) { [1]=> @@ -1439,7 +1427,7 @@ array(9) { [1]=> array(4) { ["name"]=> - string(8) "PEAR5.qa" + string(8) "pear5.qa" ["server"]=> string(15) "qa.pear.php.net" ["summary"]=> @@ -1501,11 +1489,23 @@ array(9) { } } } + ["deps"]=> + array(1) { + [1]=> + array(3) { + ["type"]=> + string(3) "php" + ["rel"]=> + string(2) "ge" + ["version"]=> + string(5) "5.0.0" + } + } } -string(1319) " +string(1313) " - PEAR5 + pear5 PEAR packages for PHP 5 pear.php.net @@ -1513,7 +1513,7 @@ string(1319) " release.list - release.list + [A-Z]+ @@ -1523,7 +1523,7 @@ string(1319) " - + Quality Assurance releases of unmaintained packages PEAR diff --git a/pear/tests/pear_dependency_checkPackage.phpt b/pear/tests/pear_dependency_checkPackage.phpt index 283526756e..90dfb556f6 100644 --- a/pear/tests/pear_dependency_checkPackage.phpt +++ b/pear/tests/pear_dependency_checkPackage.phpt @@ -225,43 +225,43 @@ not pkg2 works? yes no error has pkg2 works? no $ret is PEAR_DEPENDENCY_MISSING? yes -requires package `pkg2' +requires package `pear::pkg2' has optional pkg2 works? no $ret is PEAR_DEPENDENCY_MISSING_OPTIONAL? yes -package `pkg2' is recommended to utilize some features. +package `pear::pkg2' is recommended to utilize some features. le 0.9 works? no $ret is PEAR_DEPENDENCY_CONFLICT? yes -requires package `pkg1' <= 0.9 +requires package `pear::pkg1' <= 0.9 optional le 0.9 works? no $ret is PEAR_DEPENDENCY_CONFLICT_OPTIONAL? yes -package `pkg1' version <= 0.9 is recommended to utilize some features. Installed version is 1.0 +package `pear::pkg1' version <= 0.9 is recommended to utilize some features. Installed version is 1.0 ne 1.0 works? no $ret is PEAR_DEPENDENCY_CONFLICT? yes -requires package `pkg1' != 1.0 +requires package `pear::pkg1' != 1.0 optional ne 1.0 works? no $ret is PEAR_DEPENDENCY_CONFLICT_OPTIONAL? yes -package `pkg1' version != 1.0 is recommended to utilize some features. Installed version is 1.0 +package `pear::pkg1' version != 1.0 is recommended to utilize some features. Installed version is 1.0 ge 1.1 works? no $ret is PEAR_DEPENDENCY_UPGRADE_MINOR? yes -requires package `pkg1' >= 1.1 +requires package `pear::pkg1' >= 1.1 optional ge 1.1 works? no $ret is PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL? yes -package `pkg1' version >= 1.1 is recommended to utilize some features. Installed version is 1.0 +package `pear::pkg1' version >= 1.1 is recommended to utilize some features. Installed version is 1.0 ge 2.0 works? no $ret is PEAR_DEPENDENCY_UPGRADE_MAJOR? yes -requires package `pkg1' >= 2.0 +requires package `pear::pkg1' >= 2.0 optional ge 2.0 works? no $ret is PEAR_DEPENDENCY_UPGRADE_MAJOR_OPTIONAL? yes -package `pkg1' version >= 2.0 is recommended to utilize some features. Installed version is 1.0 +package `pear::pkg1' version >= 2.0 is recommended to utilize some features. Installed version is 1.0 gt 1.0 works? no $ret is PEAR_DEPENDENCY_UPGRADE_MINOR? yes -requires package `pkg1' > 1.0 +requires package `pear::pkg1' > 1.0 optional gt 1.0 works? no $ret is PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL? yes -package `pkg1' version > 1.0 is recommended to utilize some features. Installed version is 1.0 +package `pear::pkg1' version > 1.0 is recommended to utilize some features. Installed version is 1.0 not pkg1 works? no $ret is PEAR_DEPENDENCY_CONFLICT? yes -conflicts with package `pkg1' +conflicts with package `pear::pkg1' foobar pkg1 works? no $ret is PEAR_DEPENDENCY_BAD_DEPENDENCY? yes -relation 'foobar' with requirement '' is not supported (name=pkg1) +relation 'foobar' with requirement '' is not supported (name=pear::pkg1) diff --git a/pear/tests/pear_installer4.phpt b/pear/tests/pear_installer4.phpt index 445f5a37bf..593d38ad45 100644 --- a/pear/tests/pear_installer4.phpt +++ b/pear/tests/pear_installer4.phpt @@ -221,7 +221,7 @@ zoorb.php exists? yes goompness/Mopreeb.php exists? yes goompness/oggbrzitzkee.php exists? yes Test conflicting files: -Caught error: pkg6conflict: conflicting files found: +Caught error: pear::pkg6conflict: conflicting files found: groob\goompness\oggbrzitzkee.php (pkg6) groob\goompness\Mopreeb.php (pkg6) diff --git a/pear/tests/pear_installer_install_channels.phpt b/pear/tests/pear_installer_install_channels.phpt index 4680f3f709..ab1811db33 100644 --- a/pear/tests/pear_installer_install_channels.phpt +++ b/pear/tests/pear_installer_install_channels.phpt @@ -38,12 +38,17 @@ if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'bin')) { } // make the fake configuration - we'll use one of these and it should work $config = serialize(array('master_server' => 'pear.php.net', + 'default_channel' => 'pear', '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',)); + 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin', + '__channels' => array( + 'frob' => array( + 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob', + )))); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); @@ -59,6 +64,16 @@ if (!empty($home)) { // for PEAR_Config initialization putenv('HOME="'.$temp_path); } +require_once 'PEAR/ChannelFile.php'; +require_once 'PEAR/Registry.php'; +$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); +$chan = new PEAR_ChannelFile; +$chan->setName('frob'); +$chan->setSummary('test'); +$chan->setServer('test'); +$reg->addChannel($chan); +$chan->setName('groob'); +$reg->addChannel($chan); require_once "PEAR/Installer.php"; // no UI is needed for these tests @@ -84,106 +99,49 @@ function catchit($err) } echo "Test package.xml direct install:\n"; -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'package.xml'); +$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'package2.xml'); $reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); -var_dump($reg->listPackages()); +var_dump($reg->listAllPackages()); echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' +echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob' . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' +echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob' . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' +echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob' . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; -echo "After uninstall:\n"; -$installer->uninstall('pkg6'); -var_dump($reg->listPackages()); -echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; -echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; -echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; -echo "goompness exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness')) - ? "yes\n" : "no\n"; +echo "goompness/test.dat exists? "; +echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'pkg6' + . DIRECTORY_SEPARATOR . 'goompness' + . DIRECTORY_SEPARATOR . 'test.dat')) ? "yes\n" : "no\n"; -echo "Test .tgz install:\n"; -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'pkg6-1.1.tgz'); -$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); -var_dump($reg->listPackages()); -echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; -echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; -echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; -echo "After uninstall:\n"; -$installer->uninstall('pkg6'); -var_dump($reg->listPackages()); -echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; -echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; -echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; -echo "goompness exists? "; -echo (is_dir($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness')) - ? "yes\n" : "no\n"; +echo "Test conflicting files:\n"; +$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'conflictpackage2.xml'); -echo "Test invalid .tgz install:\n"; -$error_to_catch = 'unable to unpack ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . - 'test-pkg6' . DIRECTORY_SEPARATOR . 'invalidtgz.tgz'; -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'invalidtgz.tgz'); -$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); -var_dump($reg->listPackages()); -echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; -echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; -echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' - . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' - . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; +echo "Test unknown channel:\n"; +$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'package2_invalid.xml'); -echo "Test missing package.xml in .tgz install:\n"; -$installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test-pkg6' . DIRECTORY_SEPARATOR . 'nopackagexml.tgz'); -$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); -var_dump($reg->listPackages()); +echo "After uninstall:\n"; +$installer->uninstall('frob::pkg6'); +var_dump($reg->listAllPackages()); echo "zoorb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' +echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob' . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'zoorb.php')) ? "yes\n" : "no\n"; echo "goompness/Mopreeb.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' +echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob' . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' . DIRECTORY_SEPARATOR . 'Mopreeb.php')) ? "yes\n" : "no\n"; echo "goompness/oggbrzitzkee.php exists? "; -echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' +echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'frob' . DIRECTORY_SEPARATOR . 'groob' . DIRECTORY_SEPARATOR . 'goompness' . DIRECTORY_SEPARATOR . 'oggbrzitzkee.php')) ? "yes\n" : "no\n"; +echo "goompness/test.dat exists? "; +echo (file_exists($temp_path . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'pkg6' + . DIRECTORY_SEPARATOR . 'goompness' + . DIRECTORY_SEPARATOR . 'test.dat')) ? "yes\n" : "no\n"; chdir($curdir); cleanall($temp_path); @@ -211,49 +169,45 @@ function cleanall($dir) --POST-- --EXPECT-- Test package.xml direct install: -array(1) { - [0]=> - string(4) "pkg6" -} -zoorb.php exists? yes -goompness/Mopreeb.php exists? yes -goompness/oggbrzitzkee.php exists? yes -After uninstall: -array(0) { -} -zoorb.php exists? no -goompness/Mopreeb.php exists? no -goompness/oggbrzitzkee.php exists? no -goompness exists? no -Test .tgz install: -array(1) { - [0]=> - string(4) "pkg6" +array(3) { + ["frob"]=> + array(1) { + [0]=> + string(4) "pkg6" + } + ["groob"]=> + array(0) { + } + ["pear"]=> + array(0) { + } } zoorb.php exists? yes goompness/Mopreeb.php exists? yes goompness/oggbrzitzkee.php exists? yes +goompness/test.dat exists? yes +Test conflicting files: +Caught error: groob::pkg6conflict: conflicting files found: +groob\goompness\oggbrzitzkee.php (frob::pkg6) + groob\goompness\Mopreeb.php (frob::pkg6) + groob\goompness\test.dat (frob::pkg6) + +Test unknown channel: +Error: Unknown channel, "gorp" +Caught error: Installation failed: invalid package file, use option force to install anyway After uninstall: -array(0) { -} -zoorb.php exists? no -goompness/Mopreeb.php exists? no -goompness/oggbrzitzkee.php exists? no -goompness exists? no -Test invalid .tgz install: -Caught error: Invalid checksum for file " - + array(0) { + } + ["groob"]=> + array(0) { + } + ["pear"]=> + array(0) { + } } zoorb.php exists? no goompness/Mopreeb.php exists? no goompness/oggbrzitzkee.php exists? no +goompness/test.dat exists? no diff --git a/pear/tests/pear_packager.phpt b/pear/tests/pear_packager.phpt index 40daec7b2a..3878784718 100644 --- a/pear/tests/pear_packager.phpt +++ b/pear/tests/pear_packager.phpt @@ -60,8 +60,10 @@ if (!empty($home)) { putenv('HOME="'.$temp_path); } require_once "PEAR/Packager.php"; - +require_once 'PEAR/Registry.php'; +$reg = &new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); $packager = new PEAR_Packager(); +$packager->setRegistry($reg); $curdir = getcwd(); chdir(dirname(__FILE__)); diff --git a/pear/tests/pear_registry.phpt b/pear/tests/pear_registry.phpt index 89313618a7..e3083cbb6a 100644 --- a/pear/tests/pear_registry.phpt +++ b/pear/tests/pear_registry.phpt @@ -78,10 +78,6 @@ dumpall($reg); var_dump($reg->deletePackage("pkg2")); dumpall($reg); -echo "add package with conflicting files:\n"; -var_dump($reg->addPackage('pkg2', array('name' => 'pkg2', 'version' => '1.0', 'filelist' => $files1))); -dumpall($reg); - $reg->updatePackage("pkg3", array("version" => "3.1b1", "status" => "beta")); dumpall($reg); @@ -130,16 +126,6 @@ channel pear: pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1]) pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3]) dump done -add package with conflicting files: -caught ErrorStack error: -message: package pear::pkg2 has files that conflict with installed packages pear::pkg1 -code: -5 -bool(false) -dumping registry... -channel pear: -pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1]) -pkg3: version="3.0" filelist=array(pkg3-1.php[role=php],pkg3-2.php[role=php,baseinstalldir=pkg3]) -dump done dumping registry... channel pear: pkg1: version="1.0" filelist=array(pkg1-1.php[role=php],pkg1-2.php[role=php,baseinstalldir=pkg1]) -- 2.40.0