无法在 Laravel 项目中以调试模式运行测试

问题描述

我试图在我的 Laravel 项目中以调试模式运行测试。 测试运行但调试模式失败。我正在使用:MAMP PRO 6、PHP 7.4.9、Xdebug v2.9.6、PHPStorm。

导致此问题的原因。如何解决

在调试模式下,会出现以下消息:

Connection was not established. Cannot start debugger session with
'Xdebug 2.9.6' Validate installation

和下一个

Connection was not established.
'Xdebug 2.9.6' extension is installed. Check configuration options. Show PHPinfo

PHPini:

PHP version: 7.4.9
PHP CLI: /Applications/MAMP/bin/PHP/PHP7.4.9/bin/PHP
PHP CGI: /Applications/MAMP/bin/PHP/PHP7.4.9/bin/php-cgi 
Loaded Configuration File: /Applications/MAMP/bin/PHP/PHP7.4.9/conf/PHP.ini
Debugger extension: Xdebug 2.9.6
Loaded extensions:  bcmath,bz2,calendar,Core,ctype,curl,date,dom,exif,fileinfo,filter,ftp,gd,gettext,hash,iconv,imap,intl,json,ldap,libxml,mbstring,MysqLi,MysqLnd,openssl,pcntl,pcre,PDO,pdo_MysqL,pdo_pgsql,pdo_sqlite,pgsql,Phar,posix,readline,Reflection,session,SimpleXML,soap,sockets,sodium,SPL,sqlite3,standard,tokenizer,xdebug,xml,xmlreader,xmlrpc,xmlwriter,xsl,zip,zlib

...

enter image description here

enter image description here

enter image description here

解决方法

在 phpstorm 配置中将调试端口更改为 9001 对我有帮助。

enter image description here