PHPUnit & PHP Version


!Friendica Developers

I'm currently trying to fix some of the PHPUnit deprecation warnings, which are coming along with the new PHPUnit version 8.

But I sadly introduced a overall problem with the new unit-test behavior (downloading the PHPUnit binary for PHP 8.0 support instead of adding it as dev-dependency at composer.json): None of the PHPUnit namespaces are available anymore.. Of course => There's no PHPUnit package inside vendor anymore.. And even worse, if somebody "just" adds the phpunit as a temporary composer dependency, this person will get wrong/old phpunit binary (because of the current, minimum PHP version 7.0) and tests will brick ..

So I believe we have to rethink our strategy about the supporting PHP versions for Friendica. I'm even unsure if it's a good idea to "technically" support PHP 7.0 but use (minimum) PHP 7.2 unit-tests (which are technically incompatible with the composer.json config), so the tests are working for PHP 8.0 .. This is ugly :-/

I found a way to use any new PHP version and downgrading the code for any kind of PHP version here: github.com/rectorphp/rector

In combination with this article: blog.logrocket.com/coding-in-p… , we could upgrade to any PHP version we want, but for our "stable" deployment process, we could stay at PHP 7.0 as wanted.

The only downside would be to force "dev" and "rc" users to upgrade at minimum the PHP version we need (for PHPUnit 8.X , it's at least PHP 7.2 ). Possible solution: Maybe we could automatically create a "nightly-build" at files.friendi.ca where we downgrade the current develop branch and add it as a ZIP-File there