您好,登錄后才能下訂單哦!
yii是基于測試驅(qū)動的,而zend studio是一個好用的ide。集成就是必須的。
本文適合喜歡使用ide的開發(fā)者,vim用戶或者文本編輯器使用者請忽略。
本文使用的是最新的zend studio (版本 10.0.0)官網(wǎng)下載
yii本身沒啥可說的,主要還是phpunit相關(guān)的內(nèi)容。
創(chuàng)建完項(xiàng)目,寫一個簡單的testcase。
[php]
require_once 'test\CTestCase.php';
/**
* Task test case.
*/
class TaskTest extends CTestCase {
public function testNewArrayIsEmpty()
{
$fixture = array();
$this->assertEquals(0, sizeof($fixture));
}
}
[/php]
在 tests 目錄上直接 run as phpunit test
可以運(yùn)行,報錯:No test executed, Either a fatal error occurred, the launch was stopped manually or the script execution was halted with a ‘die’/'exit’ statement.
查看輸出:require_once(): Failed opening required 'PHPUnit/Extensions/SeleniumTestCase.php' (include_path='.;C:\Program Files (x86)\Zend\Zend Studio 10.0.0\plugins\com.zend.php.phpunit_10.0.0.201210220951\resources\library\3.6.10\;...........
原因:phpunit默認(rèn)并沒有Selenium的擴(kuò)展
解決辦法:
使用自己的pear安裝的phpunit
下載一個Selenium的擴(kuò)展,即可.(下載地址)解壓到phpunit目錄(就是上面輸出里面的地址)的Extensions
再次運(yùn)行,正常
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。