zoukankan      html  css  js  c++  java
  • 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:单元测试配置文件

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <phpunit backupGlobals="false"
     3          backupStaticAttributes="false"
     4          bootstrap="tests/bootstrap.php"
     5          colors="true"
     6          convertErrorsToExceptions="true"
     7          convertNoticesToExceptions="true"
     8          convertWarningsToExceptions="true"
     9          processIsolation="false"
    10          stopOnFailure="false"
    11          cacheResult="false">
    12     <testsuites>
    13         <testsuite name="tests">
    14             <directory suffix="Test.php">./tests</directory>
    15         </testsuite>
    16     </testsuites>
    17 </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__ . '/../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:生成测试报告目录

    5、开始调试.

     

     

    作者:Tinywan

    本文版权归作者和博客园共有。欢迎转载,但必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

    欢迎关注个人微信公众号,一起进步!扫描左方二维码即可

  • 相关阅读:
    vue路由跳转时更改页面title
    vue:axios二次封装,接口统一存放
    https://github.com/simple-uploader/vue-uploader/blob/master/README_zh-CN.md
    基于vue-simple-uploader封装文件分片上传、秒传及断点续传的全局上传插件
    前端三大主流框架的对比React、Vue、Angular 所谓是是三分天下
    React前端框架以及和Vue的对比
    Win10远程桌面:身份验证错误要求的函数不受支持的解决方法
    经典案例模块——20200404
    流的新认知
    网络编程
  • 原文地址:https://www.cnblogs.com/tinywan/p/15532136.html
Copyright © 2011-2022 走看看