Skip to content
Browse files

Provide means for test suite to pass version number validations.

  • Loading branch information...
1 parent a61f4a7 commit cd9e5346ab796150482dde483fe5e2a9b5e3515c @convissor convissor committed Dec 25, 2011
View
6 PEAR/Dependency2.php
@@ -547,6 +547,10 @@ function getPEARVersion()
function validatePearinstallerDependency($dep)
{
$pearversion = $this->getPEARVersion();
+ if (array_key_exists('PEAR_RUNTESTS_PEAR_VERSION_RETURN', $GLOBALS)) {
+ // A means for testing pear-core in local repositories.
+ return $GLOBALS['PEAR_RUNTESTS_PEAR_VERSION_RETURN'];
+ }
$extra = $this->_getExtraString($dep);
if (isset($dep['exclude'])) {
if (!is_array($dep['exclude'])) {
@@ -1355,4 +1359,4 @@ function warning($msg)
return array(sprintf($msg, $this->_registry->parsedPackageNameToString(
$this->_currentPackage, true)));
}
-}
+}
View
2 tests/PEAR_Command_Registry/info/test_installed2.0.phpt
@@ -11,8 +11,10 @@ if (!getenv('PHP_PEAR_RUNTESTS')) {
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'setup.php.inc';
$downloader = &new PEAR_Downloader($fakelog, array(), $config);
$installer = &new PEAR_Installer($fakelog);
+$GLOBALS['PEAR_RUNTESTS_PEAR_VERSION_RETURN'] = true;
$downloaded = &$downloader->download(array(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packagefiles' .
DIRECTORY_SEPARATOR . 'Console_Getopt-1.2.1.tgz'));
+unset($GLOBALS['PEAR_RUNTESTS_PEAR_VERSION_RETURN']);
$phpunit->assertNoErrors('"download"');
$phpunit->assertEquals(array(), $downloader->getErrorMsgs(), 'downloader errmessages');
$installer->setOptions(array());
View
2 tests/PEAR_Installer/test_install_cfgrole_upgrade.phpt
@@ -26,7 +26,9 @@ fclose($fp);
$dp = &new PEAR_Downloader($fakelog, array('offline' => true), $config);
$phpunit->assertNoErrors('after create');
+$GLOBALS['PEAR_RUNTESTS_PEAR_VERSION_RETURN'] = true;
$result = $dp->download(array($c1));
+unset($GLOBALS['PEAR_RUNTESTS_PEAR_VERSION_RETURN']);
$after = $dp->getDownloadedPackages();
$installer->setOptions($dp->getOptions());

0 comments on commit cd9e534

Please sign in to comment.
Something went wrong with that request. Please try again.