Fixing - PHPUnit Util Deprecated Feature Logger
In this series, i am going to cover a common bug that developers face during running the PHP Unit Tests.
Keep in mind, this error occured while I was using phpunit, version line five.
composer global require "phpunit/phpunit"
Lately, I was working on my open source project on Github, which is an Omnipay based PHP Library for NAB Transact, and stuck with the Class PHPUnit_Util_DeprecatedFeature_Logger PHP Fatal error.
This post is to help someone else that tries it – and comes across the same issue like me.
PHP Fatal error: Class PHPUnit_Util_DeprecatedFeature_Logger contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PHPUnit_Framework_TestListener::addRiskyTest) in …vendor/phpunit/phpunit/PHPUnit/Util/DeprecatedFeature/Logger.php on line 202
My phpunit.xml.dist file was like below.
backupStaticAttributes="false" bootstrap="vendor/autoload.php" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" colors="true" syntaxCheck="false"> ./tests/ ./src
My fix was simple – it took some systematic editing of the phpunit.xml.dist file to figure it out.
The actual fix was simple – the problematical line for me was:
colors = "false"
I’ve said for a long time that “you don’t get paid the big bucks for knowing what to do – it’s for knowing how to fix it when you make the inevitable screw-ups”.
Now, when I run my PHPUnit tests it is working normally.
Thanks for reading up to the end.