summaryrefslogtreecommitdiff
path: root/pear
diff options
context:
space:
mode:
authorGreg Beaver <cellog@php.net>2003-10-31 22:53:31 +0000
committerGreg Beaver <cellog@php.net>2003-10-31 22:53:31 +0000
commit014d039459eca139b29699ee32c3e75f29e91585 (patch)
treee6060573f6cb6a05b031ad78a40182350b9d0039 /pear
parent6d0360204d1d14f7c1ce9cbc282a50d66edc3281 (diff)
downloadphp-git-014d039459eca139b29699ee32c3e75f29e91585.tar.gz
add optional dependencies to test
Diffstat (limited to 'pear')
-rw-r--r--pear/tests/pear_dependency_checkPackage.phpt82
1 files changed, 80 insertions, 2 deletions
diff --git a/pear/tests/pear_dependency_checkPackage.phpt b/pear/tests/pear_dependency_checkPackage.phpt
index 3bda242fa1..75e29d4e51 100644
--- a/pear/tests/pear_dependency_checkPackage.phpt
+++ b/pear/tests/pear_dependency_checkPackage.phpt
@@ -2,11 +2,12 @@
PEAR_Dependency::checkPackage() test
--SKIPIF--
<?php
-echo 'skip';
+if (!getenv('PHP_PEAR_RUNTESTS')) {
+ echo 'skip';
+}
?>
--FILE--
<?php
-
require_once "PEAR/Registry.php";
require_once "PEAR/Dependency.php";
@@ -77,6 +78,22 @@ echo $msg . "\n";
// error conditions
$msg = 'no error';
+$ret = $dep->checkPackage($msg, 'pkg2', null, 'has');
+echo 'has pkg2 works? ';
+echo $ret ? "no\n" : "yes\n";
+echo '$ret is PEAR_DEPENDENCY_MISSING? ';
+echo ($ret == PEAR_DEPENDENCY_MISSING) ? "yes\n" : "no\n";
+echo $msg . "\n";
+
+$msg = 'no error';
+$ret = $dep->checkPackage($msg, 'pkg2', null, 'has', true);
+echo 'has optional pkg2 works? ';
+echo $ret ? "no\n" : "yes\n";
+echo '$ret is PEAR_DEPENDENCY_MISSING_OPTIONAL? ';
+echo ($ret == PEAR_DEPENDENCY_MISSING_OPTIONAL) ? "yes\n" : "no\n";
+echo $msg . "\n";
+
+$msg = 'no error';
$ret = $dep->checkPackage($msg, 'pkg1', '0.9', 'le');
echo 'le 0.9 works? ';
echo $ret ? "no\n" : "yes\n";
@@ -85,6 +102,14 @@ echo ($ret == PEAR_DEPENDENCY_CONFLICT) ? "yes\n" : "no\n";
echo $msg . "\n";
$msg = 'no error';
+$ret = $dep->checkPackage($msg, 'pkg1', '0.9', 'le', true);
+echo 'optional le 0.9 works? ';
+echo $ret ? "no\n" : "yes\n";
+echo '$ret is PEAR_DEPENDENCY_CONFLICT_OPTIONAL? ';
+echo ($ret == PEAR_DEPENDENCY_CONFLICT_OPTIONAL) ? "yes\n" : "no\n";
+echo $msg . "\n";
+
+$msg = 'no error';
$ret = $dep->checkPackage($msg, 'pkg1', '1.0', 'ne');
echo 'ne 1.0 works? ';
echo $ret ? "no\n" : "yes\n";
@@ -93,6 +118,14 @@ echo ($ret == PEAR_DEPENDENCY_CONFLICT) ? "yes\n" : "no\n";
echo $msg . "\n";
$msg = 'no error';
+$ret = $dep->checkPackage($msg, 'pkg1', '1.0', 'ne', true);
+echo 'optional ne 1.0 works? ';
+echo $ret ? "no\n" : "yes\n";
+echo '$ret is PEAR_DEPENDENCY_CONFLICT_OPTIONAL? ';
+echo ($ret == PEAR_DEPENDENCY_CONFLICT_OPTIONAL) ? "yes\n" : "no\n";
+echo $msg . "\n";
+
+$msg = 'no error';
$ret = $dep->checkPackage($msg, 'pkg1', '1.1', 'ge');
echo 'ge 1.1 works? ';
echo $ret ? "no\n" : "yes\n";
@@ -101,6 +134,14 @@ echo ($ret == PEAR_DEPENDENCY_UPGRADE_MINOR) ? "yes\n" : "no\n";
echo $msg . "\n";
$msg = 'no error';
+$ret = $dep->checkPackage($msg, 'pkg1', '1.1', 'ge', true);
+echo 'optional ge 1.1 works? ';
+echo $ret ? "no\n" : "yes\n";
+echo '$ret is PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL? ';
+echo ($ret == PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL) ? "yes\n" : "no\n";
+echo $msg . "\n";
+
+$msg = 'no error';
$ret = $dep->checkPackage($msg, 'pkg1', '2.0', 'ge');
echo 'ge 2.0 works? ';
echo $ret ? "no\n" : "yes\n";
@@ -109,6 +150,14 @@ echo ($ret == PEAR_DEPENDENCY_UPGRADE_MAJOR) ? "yes\n" : "no\n";
echo $msg . "\n";
$msg = 'no error';
+$ret = $dep->checkPackage($msg, 'pkg1', '2.0', 'ge', true);
+echo 'optional ge 2.0 works? ';
+echo $ret ? "no\n" : "yes\n";
+echo '$ret is PEAR_DEPENDENCY_UPGRADE_MAJOR_OPTIONAL? ';
+echo ($ret == PEAR_DEPENDENCY_UPGRADE_MAJOR_OPTIONAL) ? "yes\n" : "no\n";
+echo $msg . "\n";
+
+$msg = 'no error';
$ret = $dep->checkPackage($msg, 'pkg1', '1.0', 'gt');
echo 'gt 1.0 works? ';
echo $ret ? "no\n" : "yes\n";
@@ -117,6 +166,14 @@ echo ($ret == PEAR_DEPENDENCY_UPGRADE_MINOR) ? "yes\n" : "no\n";
echo $msg . "\n";
$msg = 'no error';
+$ret = $dep->checkPackage($msg, 'pkg1', '1.0', 'gt', true);
+echo 'optional gt 1.0 works? ';
+echo $ret ? "no\n" : "yes\n";
+echo '$ret is PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL? ';
+echo ($ret == PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL) ? "yes\n" : "no\n";
+echo $msg . "\n";
+
+$msg = 'no error';
$ret = $dep->checkPackage($msg, 'pkg1', null, 'not');
echo 'not pkg1 works? ';
echo $ret ? "no\n" : "yes\n";
@@ -165,21 +222,42 @@ ge 0.9 works? yes
no error
not pkg2 works? yes
no error
+has pkg2 works? no
+$ret is PEAR_DEPENDENCY_MISSING? yes
+requires package `pkg2'
+has optional pkg2 works? no
+$ret is PEAR_DEPENDENCY_MISSING_OPTIONAL? yes
+package `pkg2' is recommended to utilize some features.
le 0.9 works? no
$ret is PEAR_DEPENDENCY_CONFLICT? yes
requires package `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
ne 1.0 works? no
$ret is PEAR_DEPENDENCY_CONFLICT? yes
requires package `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
ge 1.1 works? no
$ret is PEAR_DEPENDENCY_UPGRADE_MINOR? yes
requires package `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
ge 2.0 works? no
$ret is PEAR_DEPENDENCY_UPGRADE_MAJOR? yes
requires package `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
gt 1.0 works? no
$ret is PEAR_DEPENDENCY_UPGRADE_MINOR? yes
requires package `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
not pkg1 works? no
$ret is PEAR_DEPENDENCY_CONFLICT? yes
conflicts with package `pkg1'