本文整理汇总了PHP中PEAR_Registry::_packageInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Registry::_packageInfo方法的具体用法?PHP PEAR_Registry::_packageInfo怎么用?PHP PEAR_Registry::_packageInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_Registry
的用法示例。
在下文中一共展示了PEAR_Registry::_packageInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initialize Task.
* This method includes any necessary PHPUnit2 libraries and triggers
* appropriate error if they cannot be found. This is not done in header
* because we may want this class to be loaded w/o triggering an error.
*/
function init()
{
if (version_compare(PHP_VERSION, '5.0.3') < 0) {
throw new BuildException("PHPUnit2Task requires PHP version >= 5.0.3.", $this->getLocation());
}
/**
* Ugly hack to get PHPUnit version number
*/
$config = new PEAR_Config();
$registry = new PEAR_Registry($config->get('php_dir'));
$pkg_info = $registry->_packageInfo("PHPUnit", null, "pear.phpunit.de");
if ($pkg_info != NULL) {
if (version_compare($pkg_info['version']['api'], "3.0.0") >= 0) {
PHPUnitUtil::$installedVersion = 3;
} else {
PHPUnitUtil::$installedVersion = 2;
}
} else {
/**
* Try to find PHPUnit2
*/
require_once 'PHPUnit2/Util/Filter.php';
if (!class_exists('PHPUnit2_Util_Filter')) {
throw new BuildException("PHPUnit2Task depends on PEAR PHPUnit2 package being installed.", $this->getLocation());
}
PHPUnitUtil::$installedVersion = 2;
}
// other dependencies that should only be loaded when class is actually used.
require_once 'phing/tasks/ext/phpunit/PHPUnitTestRunner.php';
require_once 'phing/tasks/ext/phpunit/BatchTest.php';
require_once 'phing/tasks/ext/phpunit/FormatterElement.php';
//require_once 'phing/tasks/ext/phpunit/SummaryPHPUnit2ResultFormatter.php';
// add some defaults to the PHPUnit filter
if (PHPUnitUtil::$installedVersion == 3) {
require_once 'PHPUnit/Util/Filter.php';
// point PHPUnit_MAIN_METHOD define to non-existing method
define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
PHPUnit_Util_Filter::addFileToFilter('PHPUnitTask.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('PHPUnitTestRunner.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing/Task.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing/Target.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing/Project.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing/Phing.php', 'PHING');
PHPUnit_Util_Filter::addFileToFilter('phing.php', 'PHING');
} else {
require_once 'PHPUnit2/Util/Filter.php';
PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTask.php');
PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTestRunner.php');
PHPUnit2_Util_Filter::addFileToFilter('phing/Task.php');
PHPUnit2_Util_Filter::addFileToFilter('phing/Target.php');
PHPUnit2_Util_Filter::addFileToFilter('phing/Project.php');
PHPUnit2_Util_Filter::addFileToFilter('phing/Phing.php');
PHPUnit2_Util_Filter::addFileToFilter('phing.php');
}
}