Laravel Homestead and PHPUnit

If you are using the homestead function described in the official documentation of the Homestead project. You can type the following command in your terminal (on Linux and Mac)

homestead ssh

After that you must delete the phpunit alias created by Homestead installation.

Just modify the file ~/.homestead/aliases and delete the line corresponding to phpunit
ex: alias phpunit="vendor/bin/phpunit"

Then you have to delete the alias saved in your system "memory" or "profile" by typing the following command in your terminal:
unalias phpunit

If everything went ok, you can now use phpunit from command line and to verify that it works correctly just type in your terminal:
phpunit --version
It should show you the current phpunit version installed on your system.

Tested in homestead 0.7 on macOS 10.12