How to begin with phpunit

Choose suitable version for install:
https://phpunit.de/index.html
For instance, if you have php version 7.0, go to:
https://phpunit.de/getting-started/phpunit-6.html
and install phpunit into your projects root folder:

composer require --dev phpunit/phpunit ^6

Installing this way (per project) to run phpunit you have to write into terminal full path to executable:

./vendor/bin/phpunit --version

Your composer.json should look similar to this:

{
   "autoload": {
      "classmap": [
         "src/"
      ]
   },
   "require-dev": {
      "phpunit/phpunit": "^6"
   }
}

!! Every time when you change composer.json you have to run !!

composer update

in terminal. Otherwise phpunit won’t recognize new dependencies.
Then follow instructions here:
https://phpunit.de/getting-started/phpunit-6.html