Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Facile.it Engineering Blog:
How to gradually upgrade toward PHPUnit 6 with namespaced classes
Sep 13, 2017 @ 16:56:03

On the Facile.it Engineering blog there's a recent post sharing some tips on how to gradually upgrade your PHPUnit tests to work with version 6 of the popular PHP unit testing tool.

In the latest months I wrote multiple times, in different projects, code migrating PHPUnit toward major version 6. This upgrade is harder than the previous one, since in this version it was introduced a big breaking change: all classes got (finally!) namespaced.

This means that any usage of those classes in your project needs to be updated. [...] In this article I will explain which steps I applied during those migrations, highlighting the most frequent hiccups.

He then start with "the easy one" to take care of the refactor: updating tests to replace the "PHPUnit_*" classes with the namespaced versions. With those out of the way, he talks about "the bumpy one" to handle: modifying test listeners to work with the new PHPUnit structure. Once these are taken care of you can then make the move up to PHPUnit 6 and PHP 7 (if you're not there already) full time.

tagged: phpunit upgrade version unittest phpunit6 php7 tutorial

Link: https://engineering.facile.it/blog/eng/phpunit-upgrade-namespace/


Trending Topics: