Configuring PHPStorm

PHPStorm has excellent support for PHPUnit and you should use the features it provides as much as possible.

Setting up PHPStorm to run tests from the IDE

It is really useful to use the PHPStorm test runner as documented in the handbook

https://www.edmondscommerce.co.uk/handbook/Development-Tools/PHPStorm/#phpunit

Once this is correctly configured, you'll have a few ways to run your tests:

  • Right-click your tests folder, then selecting Run Tests
  • Right-click any subfolder within the tests folder, then selecting Run Tests
  • Within any Test class, clicking the green play icon next to the class declaration
  • Within any Test class, clicking the green play icon next to the method signature

You'll then see the results of what has and hasn't passed.

Do not use the PHPStorm Generate Tests

As our folder structure and method naming is not what PHPStorm expects, there is no point using it.