【发布时间】:2019-11-09 05:33:03
【问题描述】:
我的配置可以使用 PHPUnit 在 PhpStorm 中成功测试我的 localhost API。我也可以在断点处停止,但只能在我的 TestCase 类中。
我需要在被测试的逻辑内部设置的断点处停止,但它不会停在那里。
测试命令:
/usr/bin/php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 /foo/vendors/composer/phpunit/phpunit/phpunit --configuration /foo/_stuff/phpunit/config-api2.xml --teamcity
我的配置 xml:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
bootstrap="../../foo/tests/app_test_case.php"
colors="true"
stopOnFailure="false"
>
<testsuites>
<testsuite name="foo">
<file>../../foo.php</file>
</testsuite>
添加到 php.ini:
xdebug.remote_autostart = 1
添加到请求的路线:
?XDEBUG_SESSION_START=PHPSTORM
并在index.php中添加cookie:
header('Cookie: XDEBUG_SESSION=PHPSTORM');
【问题讨论】: