Error when trying to get coverage in xdebug by running laravel unit test

Asked 1 months ago, Updated 1 months ago, 8 views

Prerequisites

When I tried to get coverage with xdebug by running the unit test of laravel, I got the following error:If anyone knows how to deal with it, I would appreciate it if you could let me know.

Image Description

What do you want to do

Output coverage report when running a test on phpunit.

Settings

php.ini

 [xdebug]
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so
xdebug.mode=develop,coverage,debug,gcstats,profile,trace
xdebug.start_with_request=yes
xdebug.client_host='host.docker.internal'
xdebug.client_port = 9003
xdebug.log = "/var/log/xdebug.log"
xdebug.discover_client_host=1
xdebug.remote_handler="dbgp"

phpunit.xml

...
    <coverage processUncoveredFiles="true">
        <include>
            <directory suffix=".php">./app</directory>
        </include>
        <report>
            <html outputDirectory="code-coverage" lowUpperBound="50" highLowerBound="90"/>
        </report>
    </coverage>
・・・

Supplementary information (for example, FW/Tool Version)

Ravel Framework 9.23.0

PHP 8.1.9 (cli) (build: Aug 4 2022 21:05:41) (NTS)
Copyright(c)The PHP Group
Zend Engine v4.1.9, Copyright(c)Zend Technologies
with Zend OPcache v8.1.9, Copyright(c), by Zend Technologies
with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans

Other

I'm asking the same question in terateil.
https://teratail.com/questions/i9ikbm4r40si6h

laravel phpunit

2022-09-30 11:30

1 Answers

I forgot that xdebug.ini was prepared separately.It was reflected here.


2022-09-30 11:30

If you have any answers or tips


© 2022 OneMinuteCode. All rights reserved.