yii 是基于测试驱动的, 而 zend studio 是一个好用的 ide. 集成就是必须的.
本文适合喜欢使用 ide 的开发者, VIM 用户或者文本编辑器使用者请忽略.
本文使用的是最新的 zend studio (版本 10.0.0)
yii 本身没啥可说的, 主要还是 phpunit 相关的内容.
创建完项目, 写一个简单的 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
可以运行, 报错: 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 默认并没有 Selenium 的扩展
解决办法:
使用自己的 Pear 安装的 phpunit
下载一个 Selenium 的扩展, 即可.(下载地址) 解压到 phpunit 目录 (就是上面输出里面的地址) 的 Extensions
再次运行, 正常郑州不 孕 不 育 医 院://jbk.39.NET/yiyuanzaixian/zztjyy/
来源: http://www.bubuko.com/infodetail-3046215.html