This error occurs because the assertDirectoryDoesNotExist() method in PHPUnit\Framework\Assert is marked as final, which means it cannot be overridden. The error message suggests that the method is being overridden somewhere in the code.
To fix this issue, you can try the following steps:
-
Check if any of your test classes or traits are extending or using a class that extends PHPUnit\Framework\Assert and overriding the
assertDirectoryDoesNotExist()method. -
If you find any such class or trait, remove the method override and use the original method instead.
-
If you are not able to find the source of the error, try updating your PHPUnit version to the latest version.
-
If none of the above steps work, try running
composer updateto update all the dependencies to their latest versions.
Here's an example of how to use the original assertDirectoryDoesNotExist() method in your test:
public function test_directory_does_not_exist()
{
$directory = '/path/to/non/existent/directory';
$this->assertDirectoryDoesNotExist($directory);
}