43

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

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

4

5 回答 5

51

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

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

  • pear uninstall phpunit/PHPUnit
  • pear install phpunit/PHPUnit-3.3.17
于 2009-10-21T05:26:39.793 回答
22

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

就是这样:

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

首先,您需要卸载 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

接下来按此顺序安装每个依赖项的这些特定版本,最后安装 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

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

sudo pear channel-discover components.ez.no
sudo pear install channel://components.ez.no/ConsoleTools-1.6
于 2011-11-23T21:26:14.890 回答
6

如果您收到错误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
于 2011-12-08T14:34:25.550 回答
1

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

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

于 2009-10-16T05:44:00.867 回答
0

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

卸载 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

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

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

于 2012-04-04T12:59:42.437 回答