php 如何通过 PEAR 安装旧版本的 PHPUnit?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1569012/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:06:58  来源:igfitidea点击:

How to install an older version of PHPUnit through PEAR?

phpphpunitpear

提问by Andrew

I would like to downgrade my installation of PHPUnit 3.4 to 3.3. I'm just not sure how to do it.

我想将我的 PHPUnit 3.4 安装降级到 3.3。我只是不知道该怎么做。

How do I install version 3.3 of PHPUnit on Ubuntu using PEAR?

如何使用 PEAR 在 Ubuntu 上安装 PHPUnit 3.3 版?

回答by etheros

You need to know the exact version number you wish to downgrade to. At the time of writing, the last release you're after is 3.3.17, which can be found out by checkingthe appropriate PEAR channel.

您需要知道要降级到的确切版本号。在撰写本文时,您所追求的最后一个版本是 3.3.17,可以通过检查相应的 PEAR 频道找到它。

To downgrade to that particular version execute two commands:

要降级到该特定版本,请执行两个命令:

  • pear uninstall phpunit/PHPUnit
  • pear install phpunit/PHPUnit-3.3.17
  • pear uninstall phpunit/PHPUnit
  • pear install phpunit/PHPUnit-3.3.17

回答by Jens Wegar

Note that if you wish to downgrade from a 3.6.x release to 3.5.15 (final stable 3.x release), then you need to uninstall, then reinstall several dependencies manually. Otherwise pear will just force install the latest version of PHPUnit.

请注意,如果您希望从 3.6.x 版本降级到 3.5.15(最终稳定的 3.x 版本),那么您需要卸载,然后手动重新安装几个依赖项。否则 pear 只会强制安装最新版本的 PHPUnit。

Here's how:

就是这样:

(Original instructions from Dusty Reagan's blog: http://dustyreagan.com/downgrade-phpunit-3-6-to-3-5-15/. duplicated to SO in case original link dies for some reason.)

(来自 Dusty Reagan 博客的原始说明:http: //dustyreagan.com/downgrade-phpunit-3-6-to-3-5-15/。复制到 SO,以防原始链接因某种原因失效。)

First you need to uninstall PHPUnit 3.6 and all of it's dependencies.

首先,您需要卸载 PHPUnit 3.6 及其所有依赖项。

sudo pear uninstall phpunit/PHPUnit
sudo pear uninstall phpunit/DbUnit
sudo pear uninstall phpunit/PHP_CodeCoverage
sudo pear uninstall phpunit/File_Iterator
sudo pear uninstall phpunit/PHPUnit_MockObject
sudo pear uninstall phpunit/Text_Template
sudo pear uninstall phpunit/PHP_Timer
sudo pear uninstall phpunit/PHPUnit_Selenium
sudo pear uninstall pear.symfony-project.com/YAML

Next install these specific versions of each dependency, in this order, installing PHPUnit-3.5.15 last.

接下来安装每个依赖项的这些特定版本,按此顺序,最后安装 PHPUnit-3.5.15。

sudo pear install pear.symfony-project.com/YAML-1.0.2
sudo pear install phpunit/PHPUnit_Selenium-1.0.1
sudo pear install phpunit/Text_Template-1.0.0
sudo pear install phpunit/PHPUnit_MockObject-1.0.3
sudo pear install phpunit/PHP_Timer-1.0.0
sudo pear install phpunit/File_Iterator-1.2.3
sudo pear install phpunit/PHP_CodeCoverage-1.0.2
sudo pear install phpunit/DbUnit-1.0.0
sudo pear install phpunit/PHPUnit-3.5.15

Note: You may need to add channel for PHP_CodeCoverage, which doesn't seem to be obligatory for PHPUnit 3.6

注意:您可能需要为 PHP_CodeCoverage 添加通道,这对于 PHPUnit 3.6 似乎不是必需的

sudo pear channel-discover components.ez.no
sudo pear install channel://components.ez.no/ConsoleTools-1.6

回答by toneplex

If you get the error Fatal error: Class 'PHP_Token_Stream' not found in /usr/share/pear/PHP/Token/Stream/CachingFactory.php on line 68you will need to use the following order, so that you get the correct version of PHP_TokenStream:

如果出现错误Fatal error: Class 'PHP_Token_Stream' not found in /usr/share/pear/PHP/Token/Stream/CachingFactory.php on line 68,则需要使用以下顺序,以便获得正确版本的 PHP_TokenStream:

pear uninstall phpunit/PHPUnit
pear uninstall phpunit/DbUnit
pear uninstall phpunit/PHP_CodeCoverage
pear uninstall phpunit/PHP_TokenStream
pear uninstall phpunit/File_Iterator
pear uninstall phpunit/PHP_Timer
pear uninstall phpunit/PHPUnit_MockObject
pear uninstall phpunit/Text_Template
pear uninstall phpunit/PHPUnit_Selenium
pear uninstall pear.symfony-project.com/YAML


pear install pear.symfony-project.com/YAML-1.0.2
pear install phpunit/PHPUnit_Selenium-1.0.1
pear install phpunit/Text_Template-1.0.0
pear install phpunit/PHPUnit_MockObject-1.0.3
pear install phpunit/PHP_Timer-1.0.0
pear install phpunit/File_Iterator-1.2.3
pear install phpunit/PHP_TokenStream-1.0.1
pear install phpunit/PHP_CodeCoverage-1.0.2
pear install phpunit/DbUnit-1.0.0
pear install phpunit/PHPUnit-3.5.15

回答by Nikki Erwin Ramirez

I don't know if it's always possible using PEAR alone.

我不知道是否总是可以单独使用 PEAR。

When I had to downgrade a package before, the old version was no longer available in the channel. I uninstalled the package I wanted to downgrade, downloaded the old version, and installed from the downloaded file.

当我之前不得不降级一个包时,旧版本在频道中不再可用。我卸载了我想降级的包,下载了旧版本,然后从下载的文件中安装。

回答by faramka

As to downgrading from 3.6.x to 3.5.15, it works fine for me in the following order:

至于从 3.6.x 降级到 3.5.15,按以下顺序对我来说效果很好:

Uninstallation of 3.6

3.6的卸载

sudo pear uninstall phpunit/PHPUnit_Selenium
sudo pear uninstall phpunit/PHPUnit
sudo pear uninstall phpunit/DbUnit
sudo pear uninstall phpunit/PHP_CodeCoverage
sudo pear uninstall phpunit/PHP_Iterator
sudo pear uninstall phpunit/PHPUnit_MockObject
sudo pear uninstall phpunit/Text_Template
sudo pear uninstall phpunit/PHP_Timer
sudo pear uninstall phpunit/File_Iterator
sudo pear uninstall pear.symfony-project.com/YAML

Installation of 3.5.15

3.5.15的安装

sudo pear install pear.symfony-project.com/YAML-1.0.2
sudo pear install phpunit/PHPUnit_Selenium-1.0.1
sudo pear install phpunit/PHP_Timer-1.0.0
sudo pear install phpunit/Text_Template-1.0.0
sudo pear install phpunit/PHPUnit_MockObject-1.0.3
sudo pear install phpunit/File_Iterator-1.2.3
sudo pear install phpunit/PHP_CodeCoverage-1.0.2
sudo pear install phpunit/DbUnit-1.0.0
sudo pear install phpunit/PHPUnit-3.5.15

I have found the solution HERE.

我在这里找到了解决方案。