cvs: pear-core /PEAR Dependency2.php Downloader.php /PEAR/Downloader Package.php /tests/PEAR_Dependency2 setup.php.inc
test_checkPackageDependency_PEAR_recommended_downloaded.phpt /tests/PEAR_Dependency2/packages compatpackage.xml
| From: | Greg Beaver | Date: | Thu, 21 Oct 2004 18:05:46 +0000 |
| Subject: | cvs: pear-core /PEAR Dependency2.php Downloader.php /PEAR/Downloader Package.php /tests/PEAR_Dependency2 setup.php.inc test_checkPackageDependency_PEAR_recommended_downloaded.phpt /tests/PEAR_Dependency2/packages compatpackage.xml |
||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-1100@lists.php.net to get a copy of this message | ||
cellog Thu Oct 21 14:05:46 2004 EDT
Added files:
/pear-core/tests/PEAR_Dependency2
test_checkPackageDependency_PEAR_recommended_downloaded.phpt
/pear-core/tests/PEAR_Dependency2/packages compatpackage.xml
Modified files:
/pear-core/PEAR Dependency2.php Downloader.php
/pear-core/PEAR/Downloader Package.php
/pear-core/tests/PEAR_Dependency2 setup.php.inc
Log:
complete all unit tests for recommended version, fix problems discovered in testing
http://cvs.php.net/diff.php/pear-core/PEAR/Dependency2.php?r1=1.22&r2=1.23&ty=u Index: pear-core/PEAR/Dependency2.php diff -u pear-core/PEAR/Dependency2.php:1.22 pear-core/PEAR/Dependency2.php:1.23 --- pear-core/PEAR/Dependency2.php:1.22 Thu Oct 21 12:43:44 2004 +++ pear-core/PEAR/Dependency2.php Thu Oct 21 14:05:45 2004 @@ -16,7 +16,7 @@ // | Authors: Greg Beaver <cellog@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Dependency2.php,v 1.22 2004/10/21 16:43:44 cellog Exp $ +// $Id: Dependency2.php,v 1.23 2004/10/21 18:05:45 cellog Exp $ require_once 'OS/Guess.php'; require_once 'PEAR/Validate.php'; @@ -702,6 +702,7 @@ $param = $this->_registry->getPackage($dep['name'], $dep['channel']); } if ($param) { + $found = false; foreach ($params as $parent) { if ($parent->isEqual($this->_currentPackage)) { $found = true; http://cvs.php.net/diff.php/pear-core/PEAR/Downloader.php?r1=1.38&r2=1.39&ty=u Index: pear-core/PEAR/Downloader.php diff -u pear-core/PEAR/Downloader.php:1.38 pear-core/PEAR/Downloader.php:1.39 --- pear-core/PEAR/Downloader.php:1.38 Thu Oct 21 13:25:09 2004 +++ pear-core/PEAR/Downloader.php Thu Oct 21 14:05:45 2004 @@ -19,7 +19,7 @@ // | Martin Jansen <mj@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Downloader.php,v 1.38 2004/10/21 17:25:09 cellog Exp $ +// $Id: Downloader.php,v 1.39 2004/10/21 18:05:45 cellog Exp $ require_once 'PEAR/Common.php'; require_once 'PEAR/Registry.php'; @@ -281,9 +281,6 @@ function analyzeDependencies(&$params) { foreach ($params as $i => $param) { - if ($param->isAnalyzed()) { - continue; - } $deps = $param->getDeps(); if (count($deps)) { $depchecker = &$params[$i]->getDependency2Object($this->config, @@ -406,7 +403,6 @@ return PEAR::raiseError("Cannot install, dependencies failed"); } } - $params[$i]->setAnalyzed(); } } http://cvs.php.net/diff.php/pear-core/PEAR/Downloader/Package.php?r1=1.30&r2=1.31&ty=u Index: pear-core/PEAR/Downloader/Package.php diff -u pear-core/PEAR/Downloader/Package.php:1.30 pear-core/PEAR/Downloader/Package.php:1.31 --- pear-core/PEAR/Downloader/Package.php:1.30 Thu Oct 21 13:25:09 2004 +++ pear-core/PEAR/Downloader/Package.php Thu Oct 21 14:05:45 2004 @@ -16,7 +16,7 @@ // | Authors: Gregory Beaver <cellog@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Package.php,v 1.30 2004/10/21 17:25:09 cellog Exp $ +// $Id: Package.php,v 1.31 2004/10/21 18:05:45 cellog Exp $ require_once 'Archive/Tar.php'; require_once 'PEAR/Dependency2.php'; /** @@ -156,16 +156,6 @@ return $this->_packagefile; } - function isAnalyzed() - { - return $this->_analyzed; - } - - function setAnalyzed() - { - return $this->_analyzed; - } - function &getPackageFile() { return $this->_packagefile; @@ -557,6 +547,51 @@ } } + function isCompatible($pf) + { + if (isset($this->_packagefile)) { + return $this->_packagefile->isCompatible($pf); + } else { + if (!isset($this->_downloadURL['info']['compatible'])) { + return false; + } + if (!isset($this->_downloadURL['info']['channel'])) { + return false; + } + $me = $pf->getVersion(); + $compatible = $this->_downloadURL['info']['compatible']; + if (!isset($compatible[0])) { + $compatible = array($compatible); + } + $found = false; + foreach ($compatible as $info) { + if (strtolower($info['name']) == strtolower($pf->getPackage())) { + if (strtolower($info['channel']) == strtolower($pf->getChannel())) { + $found = true; + break; + } + } + } + if (!$found) { + return false; + } + if (isset($info['exclude'])) { + if (!isset($info['exclude'][0])) { + $info['exclude'] = array($info['exclude']); + } + foreach ($info['exclude'] as $exclude) { + if (version_compare($me, $exclude, '==')) { + return false; + } + } + } + if (version_compare($me, $info['min'], '>=') && version_compare($me, $info['max'], '<=')) { + return true; + } + return false; + } + } + function getGroup() { if (isset($this->_parsedname['group'])) { http://cvs.php.net/diff.php/pear-core/tests/PEAR_Dependency2/setup.php.inc?r1=1.4&r2=1.5&ty=u Index: pear-core/tests/PEAR_Dependency2/setup.php.inc diff -u pear-core/tests/PEAR_Dependency2/setup.php.inc:1.4 pear-core/tests/PEAR_Dependency2/setup.php.inc:1.5 --- pear-core/tests/PEAR_Dependency2/setup.php.inc:1.4 Thu Oct 21 01:09:37 2004 +++ pear-core/tests/PEAR_Dependency2/setup.php.inc Thu Oct 21 14:05:46 2004 @@ -123,4 +123,15 @@ require_once 'PEAR/Config.php'; $config = &PEAR_Config::singleton();//($temp_path . '/pear.ini'); test_PEAR_Dependency2::singleton($config); +/** + * @param array + * @return test_PEAR_Downloader_Package + */ +function &newFakeDownloaderPackage($options) +{ + global $config, $fakelog; + $downloader = &new test_PEAR_Downloader($fakelog, $options, $config); + $p = &new test_PEAR_Downloader_Package($downloader); + return $p; +} ?> \ No newline at end of file http://cvs.php.net/co.php/pear-core/tests/PEAR_Dependency2/test_checkPackageDependency_PEAR_recommended_downloaded.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_Dependency2/test_checkPackageDependency_PEAR_recommended_downloaded.phpt +++ pear-core/tests/PEAR_Dependency2/test_checkPackageDependency_PEAR_recommended_downloaded.phpt --TEST-- PEAR_Dependency2->checkPackageDependency() recommended version (downloaded) --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; require_once 'PEAR/PackageFile/v1.php'; $GLOBALS['pearweb']->addXmlrpcConfig('pear.php.net', 'package.getDownloadURL', array(array('package' => 'foo', 'channel' => 'pear.php.net'), 'stable'), array('version' => '1.10', 'info' => array( 'channel' => 'pear.php.net', 'package' => 'foo', 'license' => 'PHP License', 'summary' => 'Main Package', 'description' => 'Main Package', 'releasedate' => '2003-12-06 00:26:42', 'state' => 'stable', 'apiversion' => '1.0', 'xsdversion' => '2.0', 'compatible' => array( 'name' => 'mine', 'channel' => 'pear.php.net', 'min' => '0.9', 'max' => '2.0', ), 'deps' => array( 'required' => array( 'php' => array( 'min' => '4.2', 'max' => '6.0.0', ), 'pearinstaller' => array( 'min' => '1.4.0dev13', ), ), ), ), 'url' => 'http://www.example.com/main-1.0')); $dep = &new test_PEAR_Dependency2($config, array(), array('channel' => 'pear.php.net', 'package' => 'mine'), PEAR_VALIDATE_DOWNLOADING); $phpunit->assertNoErrors('create 1'); $down = new PEAR_Downloader($fakelog, array(), $config); $dp = &new PEAR_Downloader_Package($down); $dp->initialize(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR . 'package.xml'); $params = array(&$dp); $result = $dep->validatePackageDependency( array( 'name' => 'foo', 'channel' => 'pear.php.net', 'min' => '0.9', 'max' => '1.13', 'recommended' => '1.9' ), true, $params); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'channel://pear.php.net/mine dependency package "channel://pear.php.net/foo" downloaded version 1.0 is not the recommended version 1.9, but may be compatible, use --force to install') ), 'recommended 1'); $phpunit->assertEquals(array(), $fakelog->getLog(), 'recommended 1 log'); $phpunit->assertIsa('PEAR_Error', $result, 'recommended 1'); $pf = &$dp->getPackageFile(); $pf->setVersion('1.9'); $dp->setPackageFile($pf); $result = $dep->validatePackageDependency( array( 'name' => 'foo', 'channel' => 'pear.php.net', 'min' => '0.9', 'max' => '1.9', 'recommended' => '1.9' ), true, $params); $phpunit->assertNoErrors('recommended works'); $phpunit->assertEquals(array(), $fakelog->getLog(), 'recommended works log'); $phpunit->assertTrue($result, 'recommended works'); $dp = &new PEAR_Downloader_Package($down); $dp->initialize(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR . 'compatpackage.xml'); $parent = new PEAR_PackageFile_v1; $parent->setPackage('mine'); $parent->setSummary('foo'); $parent->setDescription('foo'); $parent->setDate('2004-10-01'); $parent->setLicense('PHP License'); $parent->setVersion('1.10'); $parent->setState('stable'); $parent->setNotes('foo'); $parent->addFile('/', 'foo.php', array('role' => 'php')); $parent->addMaintainer('lead', 'cellog', 'Greg Beaver', 'cellog@php.net'); $parent->setConfig($config); $dl = &new test_PEAR_Downloader($fakelog, array(), $config); $dp2 = &new test_PEAR_Downloader_Package($dl); $dp2->setPackageFile($parent); $params = array(&$dp, &$dp2); $result = $dep->validatePackageDependency( array( 'name' => 'foo', 'channel' => 'pear.php.net', 'min' => '0.9', 'max' => '2.0', 'recommended' => '1.8' ), true, $params); $phpunit->assertNoErrors('compatible local works'); $phpunit->assertEquals(array(), $fakelog->getLog(), 'compatible local works log'); $phpunit->assertTrue($result, 'compatible local works'); $dp = &newFakeDownloaderPackage(array()); $dp->initialize('foo'); $params = array(&$dp, &$dp2); $result = $dep->validatePackageDependency( array( 'name' => 'foo', 'channel' => 'pear.php.net', 'min' => '0.9', 'max' => '2.0', 'recommended' => '1.8' ), true, $params); $phpunit->assertNoErrors('compatible local works'); $phpunit->assertEquals(array(), $fakelog->getLog(), 'compatible local works log'); $phpunit->assertTrue($result, 'compatible local works'); echo 'tests done'; ?> --EXPECT-- tests done http://cvs.php.net/co.php/pear-core/tests/PEAR_Dependency2/packages/compatpackage.xml?r=1.1&p=1 Index: pear-core/tests/PEAR_Dependency2/packages/compatpackage.xml +++ pear-core/tests/PEAR_Dependency2/packages/compatpackage.xml <package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>foo</name> <channel>pear.php.net</channel> <summary>foo</summary> <description>foo</description> <lead> <name>Greg Beaver</name> <user>cellog</user> <email>cellog@php.net</email> <active>yes</active> </lead> <date>2004-10-01</date> <version> <release>1.10</release> <api>1.0</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> <license>PHP License</license> <notes>foo</notes> <contents> <dir name="/"> <file name="foo.php" role="php" /> </dir> <!-- / --> </contents> <compatible> <name>mine</name> <channel>pear.php.net</channel> <min>0.9</min> <max>2.0</max> </compatible> <dependencies> <required> <php> <min>4.3.0</min> <max>6.0.0</max> </php> <pearinstaller> <min>1.4.0dev13</min> </pearinstaller> <package> <name>bar</name> <channel>pear.php.net</channel> <conflicts /> </package> </required> </dependencies> <phprelease /> </package>
http://cvs.php.net/diff.php/pear-core/PEAR/Dependency2.php?r1=1.22&r2=1.23&ty=u Index: pear-core/PEAR/Dependency2.php diff -u pear-core/PEAR/Dependency2.php:1.22 pear-core/PEAR/Dependency2.php:1.23 --- pear-core/PEAR/Dependency2.php:1.22 Thu Oct 21 12:43:44 2004 +++ pear-core/PEAR/Dependency2.php Thu Oct 21 14:05:45 2004 @@ -16,7 +16,7 @@ // | Authors: Greg Beaver <cellog@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Dependency2.php,v 1.22 2004/10/21 16:43:44 cellog Exp $ +// $Id: Dependency2.php,v 1.23 2004/10/21 18:05:45 cellog Exp $ require_once 'OS/Guess.php'; require_once 'PEAR/Validate.php'; @@ -702,6 +702,7 @@ $param = $this->_registry->getPackage($dep['name'], $dep['channel']); } if ($param) { + $found = false; foreach ($params as $parent) { if ($parent->isEqual($this->_currentPackage)) { $found = true; http://cvs.php.net/diff.php/pear-core/PEAR/Downloader.php?r1=1.38&r2=1.39&ty=u Index: pear-core/PEAR/Downloader.php diff -u pear-core/PEAR/Downloader.php:1.38 pear-core/PEAR/Downloader.php:1.39 --- pear-core/PEAR/Downloader.php:1.38 Thu Oct 21 13:25:09 2004 +++ pear-core/PEAR/Downloader.php Thu Oct 21 14:05:45 2004 @@ -19,7 +19,7 @@ // | Martin Jansen <mj@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Downloader.php,v 1.38 2004/10/21 17:25:09 cellog Exp $ +// $Id: Downloader.php,v 1.39 2004/10/21 18:05:45 cellog Exp $ require_once 'PEAR/Common.php'; require_once 'PEAR/Registry.php'; @@ -281,9 +281,6 @@ function analyzeDependencies(&$params) { foreach ($params as $i => $param) { - if ($param->isAnalyzed()) { - continue; - } $deps = $param->getDeps(); if (count($deps)) { $depchecker = &$params[$i]->getDependency2Object($this->config, @@ -406,7 +403,6 @@ return PEAR::raiseError("Cannot install, dependencies failed"); } } - $params[$i]->setAnalyzed(); } } http://cvs.php.net/diff.php/pear-core/PEAR/Downloader/Package.php?r1=1.30&r2=1.31&ty=u Index: pear-core/PEAR/Downloader/Package.php diff -u pear-core/PEAR/Downloader/Package.php:1.30 pear-core/PEAR/Downloader/Package.php:1.31 --- pear-core/PEAR/Downloader/Package.php:1.30 Thu Oct 21 13:25:09 2004 +++ pear-core/PEAR/Downloader/Package.php Thu Oct 21 14:05:45 2004 @@ -16,7 +16,7 @@ // | Authors: Gregory Beaver <cellog@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Package.php,v 1.30 2004/10/21 17:25:09 cellog Exp $ +// $Id: Package.php,v 1.31 2004/10/21 18:05:45 cellog Exp $ require_once 'Archive/Tar.php'; require_once 'PEAR/Dependency2.php'; /** @@ -156,16 +156,6 @@ return $this->_packagefile; } - function isAnalyzed() - { - return $this->_analyzed; - } - - function setAnalyzed() - { - return $this->_analyzed; - } - function &getPackageFile() { return $this->_packagefile; @@ -557,6 +547,51 @@ } } + function isCompatible($pf) + { + if (isset($this->_packagefile)) { + return $this->_packagefile->isCompatible($pf); + } else { + if (!isset($this->_downloadURL['info']['compatible'])) { + return false; + } + if (!isset($this->_downloadURL['info']['channel'])) { + return false; + } + $me = $pf->getVersion(); + $compatible = $this->_downloadURL['info']['compatible']; + if (!isset($compatible[0])) { + $compatible = array($compatible); + } + $found = false; + foreach ($compatible as $info) { + if (strtolower($info['name']) == strtolower($pf->getPackage())) { + if (strtolower($info['channel']) == strtolower($pf->getChannel())) { + $found = true; + break; + } + } + } + if (!$found) { + return false; + } + if (isset($info['exclude'])) { + if (!isset($info['exclude'][0])) { + $info['exclude'] = array($info['exclude']); + } + foreach ($info['exclude'] as $exclude) { + if (version_compare($me, $exclude, '==')) { + return false; + } + } + } + if (version_compare($me, $info['min'], '>=') && version_compare($me, $info['max'], '<=')) { + return true; + } + return false; + } + } + function getGroup() { if (isset($this->_parsedname['group'])) { http://cvs.php.net/diff.php/pear-core/tests/PEAR_Dependency2/setup.php.inc?r1=1.4&r2=1.5&ty=u Index: pear-core/tests/PEAR_Dependency2/setup.php.inc diff -u pear-core/tests/PEAR_Dependency2/setup.php.inc:1.4 pear-core/tests/PEAR_Dependency2/setup.php.inc:1.5 --- pear-core/tests/PEAR_Dependency2/setup.php.inc:1.4 Thu Oct 21 01:09:37 2004 +++ pear-core/tests/PEAR_Dependency2/setup.php.inc Thu Oct 21 14:05:46 2004 @@ -123,4 +123,15 @@ require_once 'PEAR/Config.php'; $config = &PEAR_Config::singleton();//($temp_path . '/pear.ini'); test_PEAR_Dependency2::singleton($config); +/** + * @param array + * @return test_PEAR_Downloader_Package + */ +function &newFakeDownloaderPackage($options) +{ + global $config, $fakelog; + $downloader = &new test_PEAR_Downloader($fakelog, $options, $config); + $p = &new test_PEAR_Downloader_Package($downloader); + return $p; +} ?> \ No newline at end of file http://cvs.php.net/co.php/pear-core/tests/PEAR_Dependency2/test_checkPackageDependency_PEAR_recommended_downloaded.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_Dependency2/test_checkPackageDependency_PEAR_recommended_downloaded.phpt +++ pear-core/tests/PEAR_Dependency2/test_checkPackageDependency_PEAR_recommended_downloaded.phpt --TEST-- PEAR_Dependency2->checkPackageDependency() recommended version (downloaded) --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; require_once 'PEAR/PackageFile/v1.php'; $GLOBALS['pearweb']->addXmlrpcConfig('pear.php.net', 'package.getDownloadURL', array(array('package' => 'foo', 'channel' => 'pear.php.net'), 'stable'), array('version' => '1.10', 'info' => array( 'channel' => 'pear.php.net', 'package' => 'foo', 'license' => 'PHP License', 'summary' => 'Main Package', 'description' => 'Main Package', 'releasedate' => '2003-12-06 00:26:42', 'state' => 'stable', 'apiversion' => '1.0', 'xsdversion' => '2.0', 'compatible' => array( 'name' => 'mine', 'channel' => 'pear.php.net', 'min' => '0.9', 'max' => '2.0', ), 'deps' => array( 'required' => array( 'php' => array( 'min' => '4.2', 'max' => '6.0.0', ), 'pearinstaller' => array( 'min' => '1.4.0dev13', ), ), ), ), 'url' => 'http://www.example.com/main-1.0')); $dep = &new test_PEAR_Dependency2($config, array(), array('channel' => 'pear.php.net', 'package' => 'mine'), PEAR_VALIDATE_DOWNLOADING); $phpunit->assertNoErrors('create 1'); $down = new PEAR_Downloader($fakelog, array(), $config); $dp = &new PEAR_Downloader_Package($down); $dp->initialize(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR . 'package.xml'); $params = array(&$dp); $result = $dep->validatePackageDependency( array( 'name' => 'foo', 'channel' => 'pear.php.net', 'min' => '0.9', 'max' => '1.13', 'recommended' => '1.9' ), true, $params); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'channel://pear.php.net/mine dependency package "channel://pear.php.net/foo" downloaded version 1.0 is not the recommended version 1.9, but may be compatible, use --force to install') ), 'recommended 1'); $phpunit->assertEquals(array(), $fakelog->getLog(), 'recommended 1 log'); $phpunit->assertIsa('PEAR_Error', $result, 'recommended 1'); $pf = &$dp->getPackageFile(); $pf->setVersion('1.9'); $dp->setPackageFile($pf); $result = $dep->validatePackageDependency( array( 'name' => 'foo', 'channel' => 'pear.php.net', 'min' => '0.9', 'max' => '1.9', 'recommended' => '1.9' ), true, $params); $phpunit->assertNoErrors('recommended works'); $phpunit->assertEquals(array(), $fakelog->getLog(), 'recommended works log'); $phpunit->assertTrue($result, 'recommended works'); $dp = &new PEAR_Downloader_Package($down); $dp->initialize(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR . 'compatpackage.xml'); $parent = new PEAR_PackageFile_v1; $parent->setPackage('mine'); $parent->setSummary('foo'); $parent->setDescription('foo'); $parent->setDate('2004-10-01'); $parent->setLicense('PHP License'); $parent->setVersion('1.10'); $parent->setState('stable'); $parent->setNotes('foo'); $parent->addFile('/', 'foo.php', array('role' => 'php')); $parent->addMaintainer('lead', 'cellog', 'Greg Beaver', 'cellog@php.net'); $parent->setConfig($config); $dl = &new test_PEAR_Downloader($fakelog, array(), $config); $dp2 = &new test_PEAR_Downloader_Package($dl); $dp2->setPackageFile($parent); $params = array(&$dp, &$dp2); $result = $dep->validatePackageDependency( array( 'name' => 'foo', 'channel' => 'pear.php.net', 'min' => '0.9', 'max' => '2.0', 'recommended' => '1.8' ), true, $params); $phpunit->assertNoErrors('compatible local works'); $phpunit->assertEquals(array(), $fakelog->getLog(), 'compatible local works log'); $phpunit->assertTrue($result, 'compatible local works'); $dp = &newFakeDownloaderPackage(array()); $dp->initialize('foo'); $params = array(&$dp, &$dp2); $result = $dep->validatePackageDependency( array( 'name' => 'foo', 'channel' => 'pear.php.net', 'min' => '0.9', 'max' => '2.0', 'recommended' => '1.8' ), true, $params); $phpunit->assertNoErrors('compatible local works'); $phpunit->assertEquals(array(), $fakelog->getLog(), 'compatible local works log'); $phpunit->assertTrue($result, 'compatible local works'); echo 'tests done'; ?> --EXPECT-- tests done http://cvs.php.net/co.php/pear-core/tests/PEAR_Dependency2/packages/compatpackage.xml?r=1.1&p=1 Index: pear-core/tests/PEAR_Dependency2/packages/compatpackage.xml +++ pear-core/tests/PEAR_Dependency2/packages/compatpackage.xml <package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>foo</name> <channel>pear.php.net</channel> <summary>foo</summary> <description>foo</description> <lead> <name>Greg Beaver</name> <user>cellog</user> <email>cellog@php.net</email> <active>yes</active> </lead> <date>2004-10-01</date> <version> <release>1.10</release> <api>1.0</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> <license>PHP License</license> <notes>foo</notes> <contents> <dir name="/"> <file name="foo.php" role="php" /> </dir> <!-- / --> </contents> <compatible> <name>mine</name> <channel>pear.php.net</channel> <min>0.9</min> <max>2.0</max> </compatible> <dependencies> <required> <php> <min>4.3.0</min> <max>6.0.0</max> </php> <pearinstaller> <min>1.4.0dev13</min> </pearinstaller> <package> <name>bar</name> <channel>pear.php.net</channel> <conflicts /> </package> </required> </dependencies> <phprelease /> </package>