目录结构

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

(1)Path mappings 目录配置
注意:Remote Path 是不需要配置的哦!
注意:Remote Path 是不需要配置的哦!
(2)Docker Container 目录配置

注意:Container Path 是不需要配置的哦!
注意:Container Path 是不需要配置的哦!
注意:Container Path 是不需要配置的哦!
设置 Test Framework
(1)安装 phpunit 组件库
composer require --dev phpunit/phpunit
(2)配置单元测试配置文件

单元测试配置文件
(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 WebmanBootstrap;
use WebmanConfig;
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) {
/** @var Bootstrap $class_name */
$class_name::start(null);
}
(4)build:生成测试报告目录
开始调试

原文始发于微信公众号(开源技术小栈):如何使用Docker和PHPUnit在PHPStrom中配置Webman单元测试
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/248100.html