单元测试在用PHP开发大型项目时必备的减少测试难度和提高测试效率的利器,而PHPUnit是php做单元测试时使用范围最广的一个。如果在window系统中开发,就要调用控制台来运行phpunit,非常的不方便,幸好zend studio 7.* 已经整合进了phpunit。只要简单配置可以通过点点鼠标就完成测试了。下面简要记录一下配置步骤:
1、首先在zend studio 中新建一个项目。
2、在项目项目上右键 出现 Properties ,点击 Properties 在出现的框中选择 PHP Include Path -> Libraries -> Add Library ,选择PHPUnit 3.x 即可。如图:

3、新建一个测试用例(这和新建一个PHP文件一样,在new列表中可以选择),在里面写测试用例即可。phpunit3安装试用小记有个现成的测试文件,可以复制下来直接试用一下。注意使用zend studio时就不用安装和include() phpunit了,因为 400M的zend studio已经为我们准备好了一切,我的这个例子里include()了TestCase.php是因为测试用例还在要linux下面跑。

4、写好测试用例后在测试用例文件上右键 Run As -> PHPUnit Test ,这时会弹出个层,显示测试详细结果和代码覆盖率信息。

代码测试覆盖情况:

在zend studio 9.* 中使用phpunit进行单元测试的更多相关文章

  1. Zend Studio 12.0.2正式版发布和破解方法,zend studio 12.0.1汉化,相式设置为Dreamweaver,空格缩进为4个, 代码默认不折叠的设置,Outline中使用的图形标志,代码颜色之eot设置。

    背景:zend studio 12.0.2 修复了一个12.0.1的:  Fixed problem with referenced variables marked as undefined,我都说 ...

  2. PHP(Zend Studio)入门视频

    视频地址: http://www.ev-get.com/article/2014/5/9/20962.html (去掉地址中的减号-:可以看视频) Zend Studio教学视频之Zend Studi ...

  3. zend studio 的使用

    1.将php项目导入到zend studio 中的方式为:http://my.oschina.net/maomi/blog/86077: 2.zend studio中将php项目导出的方式为:如果你会 ...

  4. zend studio 9.0.4 破解、汉化和字体颜色及快捷键相关设置

    转载:http://www.penglig.com/post-45.html 下载:http://www.geekso.com/component/zendstudio-downloads/ 破解:h ...

  5. zend studio一些常用配置

    zend studio 常用 配置 1.zend中添加注释是ctrl+slash,这个slash在哪里?如何来取消注释 slash是斜杠'/'那个键,就是在,.之后的那个. 进行注释是 ctrl+'/ ...

  6. zend studio 10 字体,颜色,快捷键等相关设置

    一.修改字体 没想到zend studio 10中对中文显示不太好看,似乎有点小了.修改如下:打开 Window->Preferences->General->Appearance- ...

  7. zend studio修改字体

    zend studio修改字体 没想到zend studio 9中对中文显示不太好看,似乎有点小了.修改如下:打开Window->Preferences->General->Appe ...

  8. zend studio 破解、汉化和字体颜色及快捷键相关设置

    下载:http://www.geekso.com/component/zendstudio-downloads/ 破解:http://www.geekso.com/ZendStudio9-key/ 注 ...

  9. zend studio 提升开发效率的快捷键及可视化订制相关设置

    Zend studio快捷键使用 F3 快速跳转到当前所指的函数,常量,方法,类的定义处,相当常用.当然还可以用Ctrl+鼠标左键 shift+end 此行第一个到最后一个 shift+home 此行 ...

随机推荐

  1. android布局之线性布局

    LinearLayout 线性布局有两种,分别是水平线性布局和垂直线性布局,LinearLayout属性中android:orientation为设置线性布局当其="vertical&quo ...

  2. gitlab 启动参考

    第一步 启动gitlab bundle exec rails s -e production -d 第二步 启动redis /etc/init.d/redis start chkconfig redi ...

  3. Present ViewController Modally

    一.主要用途 弹出模态ViewController是IOS变成中很有用的一个技术,UIKit提供的一些专门用于模态显示的ViewController,如UIImagePickerController等 ...

  4. [RxJS] Combination operator: combineLatest

    While merge is an OR-style combination operator, combineLatest is an AND-style combination operator. ...

  5. JAAS authentication in Tomcat example--reference

    In this tutorial you will learn how to configure JAAS authentication in Tomcat using the HTTP Basic ...

  6. mysql默认用户名和密码

    默认用户名:root 密码:gree..

  7. myeclipse配置svn亲测

    1.安装目录更改为myeclipse install 目录:E:\MyEclipse85\MyEclipse 8.5common 目录:           E:\MyEclipse85\Common ...

  8. Java 单文件下载及重命名

    代码(仅供参考): /* * 另存为 */ @RequestMapping("/saveAs.do") public @ResponseBody void saveAs(Strin ...

  9. 实用脚本 - - insertAfter 在现有元素后插入一个新元素

    function insertAfter(newElement,targetElement){ var parent = targetElement.parentNode; if(parent.las ...

  10. 单例模式,多种实现方式JAVA

    转载请注明出处:http://cantellow.iteye.com/blog/838473 第一种(懒汉,线程不安全): public class Singleton { private stati ...