下面由phpstorm教程欄目給大家介紹phpstrom docker phpunit 配置webman單元測試 ,希望對需要的朋友有所幫助!
1、項目結構
2、Cli Interpreter 設置
這里的注意點就是映射目錄的配置,是一個坑
立即學習“PHP免費學習筆記(深入)”;
?(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> ????<testsuites> ????????<testsuite> ????????????<Directory>./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:生成測試報告目錄
5、開始調試.
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END