When you run $ phpunit on the command-line (e.g. bash), the system will look for phpunit using the PATH variable, from the bash docs:
PATH The search path for commands. It is a colon-separated list of directories in which the shell
looks for commands (see COMMAND EXECUTION below). A zero-length (null) directory name in the
value of PATH indicates the current directory. A null directory name may appear as two adja‐
cent colons, or as an initial or trailing colon. The default path is system-dependent, and
is set by the administrator who installs bash. A common value is ``/usr/local/bin:
/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin''.
You can bypass search using the PATH variable by using an absolute path:
$ /absolute/path/to/vendor/bin/phpunit
Or a relative path (the stop character (.) means the current directory):
$ ./vendor/bin/phpunit
You actually omit the stop slash part: $ vendor/bin/phpunit.
To avoid having to type the path you can use a bash alias (if you're using bash):
$ alias phpunit='./vendor/bin/phpunit'
Or to save typing:
$ alias p='./vendor/bin/phpunit'
See How do I create a permanent bash alias for more information on aliases.
phpunitexecutable file to the command line, i.e:[yourprojectdir]/vendor/bin/phpunit testfile.php"require"section which will install phpunit in production mode, it is recommend to put dependencies which you only need during development mode inside"required-dev"section, make your project cleaner and lighter.