phpstrom如何配置webman单元测试
这篇文章主要介绍“phpstrom如何配置webman单元测试”,在日常操作中,相信很多人在phpstrom如何配置webman单元测试问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”phpstrom如何配置webman单元测试”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
1、项目结构
2、Cli Interpreter 设置
这里的注意点就是映射目录的配置,是一个坑
(1)Path mappings 目录配置
注意:Remote Path 是不需要配置的哦!
(2)Docker Container 目录配置
注意:Container Path 是不需要配置的哦!
3、设置 Test Framework
(1)安装 phpunit 组件库
composerrequire--devphpunit/phpunit
(2)配置单元测试配置文件
4、配置文件
(1)phpunit.xml:单元测试配置文件
<?xmlversion="1.0"encoding="UTF-8"?><phpunitbackupGlobals="false"backupStaticAttributes="false"bootstrap="tests/bootstrap.php"colors="true"convertErrorsToExceptions="true"convertNoticesToExceptions="true"convertWarningsToExceptions="true"processIsolation="false"stopOnFailure="false"cacheResult="false"><testsuites><testsuitename="tests"><directorysuffix="Test.php">./tests</directory></testsuite></testsuites></phpunit>
(2)tests:存放测试代码目录
(3)tests/bootstrap.php 脚手架入口
<?php/***@descbootstrap.php描述信息*@authorTinywan(ShaoBoWan)*@date2021/11/918:00*/useWebman\Bootstrap;useWebman\Config;require_once__DIR__.'/../vendor/autoload.php';Config::load(config_path(),['route','container']);if($timezone=config('app.default_timezone')){date_default_timezone_set($timezone);}foreach(config('autoload.files',[])as$file){include_once$file;}foreach(config('bootstrap',[])as$class_name){/**@varBootstrap$class_name*/$class_name::start(null);}
(4)build:生成测试报告目录
5、开始调试.
到此,关于“phpstrom如何配置webman单元测试”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!