Home Development Tools phpstorm How to configure webman unit testing in phpstrom

How to configure webman unit testing in phpstrom

Dec 31, 2021 pm 02:54 PM

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 library

1

composer require --dev phpunit/phpunit

Copy after login

(2) Configure unit test configuration file

##4. Configuration file

(1) phpunit.xml: unit test configuration file

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

<?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>

Copy after login
(2) tests: Directory to store test code

(3)tests/bootstrap.php scaffolding entrance

1

2

3

4

5

6

7

8

9

10

11

12

<?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);

}

Copy after login
(4)build: Generate test report directory

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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)