PHPStorm 10 配置PHPUnit

PHPStorm 10 配置PHPUnit

PHPUnit的安裝

自己用的是Xampp,PHPUnit好像自帶不好用。
不說廢話:
自己看
According to official site
https://phpunit.de/

PHPUnit 5.2 is supported on PHP 5.6 and PHP 7.
PHPUnit 4.8 is supported on PHP 5.3, PHP 5.4, PHP 5.5, and PHP 5.6.

自己下載,簡單粗暴。不需要用PEAR
I like to download it manually rather than by a program or command(via pear).

or you can download phpunit.phar from
https://phar.phpunit.de/
for Windows:
echo @php “%~dp0phpunit.phar” %* > phpunit.cmd
in your Xampp/php directory
read more about it:
http://www.phpunit.cn/getting-started.html
if you’re using Linux.

設置PhpStorm選項

File -> Settings -> Languages and Frameworks -> PHP -> PHPUnit
choose path to phpunit.phar then add
J:\xampp\php\phpunit.phar

爲PHPStorm提供phpUnit代碼自動完成

code completion for phpstorm using phpstorm

File -> Settings -> Languages and Frameworks -> PHP
添加include path:
你可以把phpunit.phar扔進去:
J:\xampp\php\phpunit-storm
然後你的PHPstorm代碼測試裏面 PHPUnit_Framework_TestCase 就不會報錯找不到之類的。

Composer配置

懶得寫,跟這個差不多

超級好的站點:
http://www.phpcomposer.com/
http://pkg.phpcomposer.com/
http://pkg.phpcomposer.com/#composer-mirror
<<<<<<<安裝說明

再繼續研究,轉行做專業測試算了,用PHPUnit的很少啊。。上github搜phpunit.xml有例子。

發佈了119 篇原創文章 · 獲贊 41 · 訪問量 36萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章