码迷,mamicode.com
首页 > Web开发 > 详细

PHPstorm配置PHPunit对composer引入的php代码进行单元测试

时间:2018-07-04 20:13:58      阅读:608      评论:0      收藏:0      [点我收藏+]

标签:.com   org   unit   use   get   lan   alt   tor   模式   

 1、 如何安装PHPunit,这里不展述(如需打断点debug测试,安装PHP的xdebug扩展方法也不展开说了 https://xdebug.org/

 

2、如何进行配置

以 PHP设计模式的代码为例 https://github.com/domnikl/DesignPatternsPHP.git

先克隆下来

git colonel https://github.com/domnikl/DesignPatternsPHP.git

再打开

cd DesignPatternsPHP

安装依赖

composer install

 

好了,想对拉下来的包在测试方法或者测试类中debug测试跟踪代码

 

PHPstorm配置如下

技术分享图片

 

bootstrap.php

<?php
/**
 * User: szliugx@gmail.com
 * Date: 2018/7/4
 * Time: 下午6:35
 */


require __DIR__.‘/vendor/autoload.php‘;

 

3、如何在测试方法中打断点debug测试

技术分享图片

 

配置就这么完成了

 

PHPstorm配置PHPunit对composer引入的php代码进行单元测试

标签:.com   org   unit   use   get   lan   alt   tor   模式   

原文地址:https://www.cnblogs.com/liugx/p/9264943.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!