[英]How do I run multiple versions of PHPUnit on the same machine?
我正在為一些項目使用Zend Framework,並希望為它們構建PHPUnit測試套件。 不幸的是,Zend Framework中的當前版本(1.11.x)僅支持PHPUnit 3.5。 與此同時,我還想開始使用Symfony框架,而Symfony框架又支持更新版本的PHPUnit。 那么問題是,如何在我的開發機器上同時運行多個版本的PHPUnit而無需安裝單獨的服務器或類似的東西?
我正在運行OS X Lion(10.7)並使用通過MacPorts安裝的apache和php(5.3.10)。 理想情況下,我想最終在一種情況下我可以在終端中輸入例如phpunit5來執行3.5版本並鍵入phpunit6來執行3.6版本,依此類推。
我建議你查看這篇博文:
有關廚師食譜,請查看我的博文:
如果鏈接停止工作:
--installroot
開關 例:
pear install --installroot / some / path / phpunit34 pear.phpunit.de/PHPUnit-3.4.15
安裝完成后,您可能需要將/some/path/phpunit34/usr/bin/
到$PATH
或創建符號鏈接到/usr/bin
如博客文章所示。
HTH
當你安裝phpunit 3.4時,接受的答案是有效的,但是如果你想安裝phpunit 3.5(它也可以用於Zend項目中的單元測試,雖然Zends自己的測試可能都沒有通過),你必須遵循一個稍微不同的路徑。 在安裝phpunit之前,你需要單獨安裝phpunit 3.5的依賴項,否則一些依賴項只會強制安裝phpunit 3.6:
首先安裝(注意-f選項,它強制安裝特定版本):
sudo pear install -f --installroot /your/path/to/PHPUnit35 pear.symfony-project.com/YAML-1.0.2
sudo pear install -f --installroot /your/path/to/PHPUnit35 pear.phpunit.de/PHPUnit_Selenium-1.0.1
sudo pear install -f --installroot /your/path/to/PHPUnit35 pear.phpunit.de/PHP_Timer-1.0.0
sudo pear install -f --installroot /your/path/to/PHPUnit35 pear.phpunit.de/Text_Template-1.0.0
sudo pear install -f --installroot /your/path/to/PHPUnit35 pear.phpunit.de/PHPUnit_MockObject-1.0.3
sudo pear install -f --installroot /your/path/to/PHPUnit35 pear.phpunit.de/File_Iterator-1.2.3
sudo pear install -f --installroot /your/path/to/PHPUnit35 pear.phpunit.de/PHP_CodeCoverage-1.0.2
sudo pear install -f --installroot /your/path/to/PHPUnit35 pear.phpunit.de/DbUnit-1.0.0
sudo pear install -f --installroot /your/path/to/PHPUnit35 pear.phpunit.de/PHPUnit-3.5.15
然后按照接受的答案鏈接中的說明更改包含路徑並正確添加符號鏈接。
PHPUnit現在為https://phar.phpunit.de/提供所有版本的捆綁PHAR文件
只需下載所需的版本並使用以下方法調用它們:
php phpunit-X.Y.Z.phar
(其中XYZ
是PHPUnit版本)
PHAR文件很容易被別名化,以使它們在系統范圍內可用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.