How to keep phpunit up to date in Devilbox?

I’ve cloned the latest iteration of Devilbox and have my project up and running… When I run unit tests, via PHPUnit, however, its running PHPUnit v7.x. I can update to the latest by doing this:

$ wget https://phar.phpunit.de/phpunit.phar
$ chmod +x phpunit.phar
$ sudo mv phpunit.phar /usr/local/bin/phpunit

Of course that does not persist if I rm -f my containers.

My question, is there a permanent way to get updated PHPUnit to persist? Or even a script to be run to keep it up to date on docker-compose up?

You may create a script file into cfg/php-startup-8.0/phpunit.sh and put your commands there: they will be executed on every Devilbox startup.
Be sure to select the appropriate php-startup-<version> folder.

@cytopia maybe is there a method to upgrade some default packages (ex: NPM, Yarn, etc.)?

1 Like

Thanks. This solution works great.

One thing to note, if you are on windows, be sure to convert your line endings to UNIX format.

In Sublime Text, this can be found at View > Line Endings > Unix.