phpstrom怎麼配置webman單元測試

藏色散人
發布: 2021-12-31 14:54:14
轉載
1965 人瀏覽過

下面由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中文網其他相關文章!

相關標籤:
來源:cnblogs.com
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!