我在 php8.3 上使用 Symfony 6.4,有一个测试,它表明我有弃用,但不知道它们在哪里或是什么。我使用 phpunit 11.5 这是我的 phpunit.xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
colors="true"
bootstrap="tests/bootstrap.php"
cacheResult="false"
executionOrder="default"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnPhpunitDeprecations="true"
cacheDirectory=".phpunit.cache"
testdox="false">
<php>
<ini name="error_reporting" value="-1"/>
<server name="APP_ENV" value="test" force="true"/>
<server name="SHELL_VERBOSITY" value="-1"/>
<server name="KERNEL_CLASS" value="App\Kernel"/>
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
<env name="CORS_ALLOW_ORIGIN" value="^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$"/>
</php>
<extensions>
<bootstrap class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension" />
</extensions>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
这是我运行测试时的结果:
$ bin/phpunit tests/Controller/PlaceholderControllerTest.php
PHPUnit 11.5.0 by Sebastian Bergmann and contributors.
Runtime: PHP 8.3.10
Configuration: /var/www/phpunit.xml
.. 2 / 2 (100%)
Time: 00:00.771, Memory: 10.00 MB
OK (2 tests, 5 assertions)
Remaining direct deprecation notices (12)
我应该更改什么设置才能显示有关弃用的更多信息? 如您所见,我已经激活了该选项,该选项显示弃用并且 testdox 设置为 false。 我还尝试从配置中完全删除 textdox。一切都没有改变。
尝试添加此参数:
--display-deprecations
原来如此
bin/phpunit --display-deprecations tests/Controller/PlaceholderControllerTest.php
参见https://docs.phpunit.de/en/11.5/textui.html#details-about-issues