Run phpunit for Drupal 8 in phpstorm
Since http://drupal.org/node/1567500 Drupal 8 started to use PHPUnit as it's unit test framework. One advantage of PHPUnit is that there are tools around which support it already.
One example is phpstorm
which is a great IDE for php developers.
This blog post describes how you can setup to run phpunit in phpstorm.
Step 1: Create a new run configuration
You start by clicking on the arrow in the UI and choose "Edit Configuration". (See Screenshot).
Step 2: Create a new phpunit configuration
You continue with clicking on the green "plus" on the left top
corner. There you choose phpunit.
Step 3: Configure it properly
The tricky part is to configure it properly. Just use "defined in the configuration file", specify the right location and add the testrunner code. (For lazy people, just use the code below )
<br>/var/www/d8/core/phpunit.xml.dist
-d auto_prepend_file=/var/www/d8/core/tests/bootstrap.php
Step 4: Profit!
From now on you don't even have to leave your IDE anymore just to develop stuff. Another reason why we should start to write more and more tests in PHPUnit.
Please comment and share other tips with phpunit/phpstorm in the comments.
AnhangGrösse phpunit1.png7.63 KB phpunit2.png8.63 KB phpunit3.png23.25 KB phpunit4.png30.01 KB