登录  /  注册

phpstrom怎么配置webman单元测试

藏色散人
发布: 2021-12-31 14:54:14
转载
1766人浏览过

下面由phpstorm教程栏目给大家介绍phpstrom docker phpunit 配置webman单元测试 ,希望对需要的朋友有所帮助!

1、项目结构

2、Cli Interpreter 设置

这里的注意点就是映射目录的配置,是一个坑

 (1)Path mappings 目录配置

注意:Remote Path 是不需要配置的哦! 
注意:Remote Path 是不需要配置的哦! 
注意:Remote Path 是不需要配置的哦! 

(2)Docker Container 目录配置

注意:Container Path 是不需要配置的哦! 
注意:Container Path 是不需要配置的哦! 
注意:Container Path 是不需要配置的哦! 

3、设置 Test Framework

(1)安装 phpunit 组件库

composer require --dev phpunit/phpunit
登录后复制

(2)配置单元测试配置文件

4、配置文件

(1)phpunit.xml:单元测试配置文件

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="tests/bootstrap.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         cacheResult="false">
    <testsuites>
        <testsuite name="tests">
            <directory suffix="Test.php">./tests</directory>
        </testsuite>
    </testsuites>
</phpunit>
登录后复制

(2)tests:存放测试代码目录

(3)tests/bootstrap.php 脚手架入口

<?php
/**
 * @desc bootstrap.php 描述信息
 * @author Tinywan(ShaoBo Wan)
 * @date 2021/11/9 18:00 */use Webman\Bootstrap;use Webman\Config;require_once __DIR__ . &#39;/../vendor/autoload.php&#39;;

Config::load(config_path(), [&#39;route&#39;, &#39;container&#39;]);if ($timezone = config(&#39;app.default_timezone&#39;)) {
    date_default_timezone_set($timezone);
}foreach (config(&#39;autoload.files&#39;, []) as $file) {    include_once $file;
}foreach (config(&#39;bootstrap&#39;, []) as $class_name) {    /** @var Bootstrap $class_name */
    $class_name::start(null);
}
登录后复制

(4)build:生成测试报告目录

5、开始调试.

以上就是phpstrom怎么配置webman单元测试的详细内容,更多请关注php中文网其它相关文章!

智能AI问答
PHP中文网智能助手能迅速回答你的编程问题,提供实时的代码和解决方案,帮助你解决各种难题。不仅如此,它还能提供编程资源和学习指导,帮助你快速提升编程技能。无论你是初学者还是专业人士,AI智能助手都能成为你的可靠助手,助力你在编程领域取得更大的成就。
来源:cnblogs网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
作者最新文章
最新问题
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号