Get more details in PHPUnit

During the writing tests for one of my services I met a bit unpleasant issue, which looked like this:

PHPUnit 11.4.2 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.8
Configuration: project/path

..                                                                  2 / 2 (100%)

Time: 00:00.711, Memory: 54.50 MB

OK, but there were issues!
Tests: 2, Assertions: 8, PHPUnit Deprecations: 2.

If you don't see it- let me point with a finger: PHPUnit Deprecations: 2. And as you probably already have noticed- no any additional information provided. As unknown issues can be the same annoying as errors and deprecations can backfire in the long run, I was intended to fix the problem from the beginning and preferably get some more information.

To get more information about deprecations, go to your phpunit.xml file and in <phpunit> add next attributes:

displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnPhpunitDeprecations="true"

If you want to get a bit more information on errors, notices and warning when running phpunit you can make your phpunit.xml to look next way:

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         colors="true"
         displayDetailsOnTestsThatTriggerDeprecations="true"
         displayDetailsOnTestsThatTriggerErrors="true"
         displayDetailsOnTestsThatTriggerNotices="true"
         displayDetailsOnTestsThatTriggerWarnings="true"
         displayDetailsOnPhpunitDeprecations="true">

After getting additional details on my tests, I got nice output: Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead. Which was a reference to @test so after removing it from doc-comments, I got nice, clean and green view of my tests passing:

PHPUnit 11.4.2 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.8
Configuration: project/path

..                                                                  2 / 2 (100%)

Time: 00:00.729, Memory: 54.50 MB

OK (2 tests, 8 assertions)

But in general I highly recommend to get familiar with PHPUnit documentation