When testing deprecations with PHPUnit greater than 9.5.10 you might encounter this error:
Failed asserting that exception of type "PHPUnit\Framework\Error\Deprecated" is thrown.
The code in the test is as follows:
$this->expectDeprecation();
and the code that should be tested is like this:
\trigger_error('foo', \E_USER_DEPRECATED);