The following tutorial column will introduce you to phpstrom docker phpunit configuration webman unit test from the phpstorm tutorial column. I hope it will be helpful to friends in need!
1. Project structure
##2 , Cli Interpreter settings
The point to note here is the configuration of the mapping directory, which is a pitfall
(1) Path mappings directory configuration
Note: Remote Path is not required Configured! Note: Remote Path does not need to be configured!
Note: Remote Path does not need to be configured!
(2) Docker Container directory configuration
Note : Container Path does not need to be configured! Note: Container Path does not need to be configured!
Note: Container Path does not need to be configured!
3. Set up Test Framework
##(1) Install phpunit component librarycomposer require --dev phpunit/phpunit
##4. Configuration file
(1) phpunit.xml: unit test configuration file
<?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>
(3)tests/bootstrap.php scaffolding entrance
<?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); }
5. Start debugging.
The above is the detailed content of How to configure webman unit testing in phpstrom. For more information, please follow other related articles on the PHP Chinese website!