window中用pear安裝phpunit

1.安裝pear
1)在命令行中,進入php安裝目錄,如我的目錄D:\php\Zend\ZendServer\bin,運行:

go-pear
若出現以下錯誤:
phar "D:\php\Zend\ZendServer\bin\PEAR\go-pear.phar" does not have a signature
Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: pha
r error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in D:\
php\Zend\ZendServer\bin\PEAR\go-pear.phar on line 1236

解決方法:打開php.ini文件,在最後一行加上:phar.require_hash = Off

4)此時pear應該安裝成功了,更新至最新版本:

pear upgrade-all
(這一步挺重要的,phpunit貌似是使用pear的1.9.x才能安裝)
2.安裝phpunit:
1)添加phpunit的頻道

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
2)安裝:

pear install phpunit/PHPUnit
若出現此錯誤:
Fatal error:require_once():Failed opening required ‘Structures/Graph.php’
解決方法如下,下載此壓縮包:

http://download.pear.php.net/package/Structures_Graph-1.0.3.tgz

解壓並把Structures目錄複製到D:\php\Zend\ZendServer\bin\PEAR下

若出現:
could not extract the package.xml file
Error:cannot download “phpunit/XXXX”
可能是pear下載目錄的路徑有空格如:D:/program files/
解決方法如下:

pear config-set temp_dir "C:\tmp"
pear config-set download_dir "C:\tmp"
這裏設置目錄的路徑無空格就行了,想設哪裏到是無所謂。

最後測試下是否安裝成功,cmd中運行:

phpunit

3、zendStudio8 整合phpunit

1)、首先在zend studio 中新建一個項目。
2)、在項目項目上右鍵 出現 Properties ,點擊 Properties 在出現的框中選擇 PHP Include Path -> Libraries -> Add Library ,選擇PHPUnit 3.x 即可。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章