Categories
Laravel Samuel Test Driven Laravel Series

Setting up phpstorm to run unit tests

In This post we will go through the process of setting up phpstorm to run our tests.

Step 1:

Our first step is to get to the phpunit settings portion of phpstorm, to do this we can type control + shift + a or we can type “shift shift” and then type phpunit. The easier method is to hit control + shift + a, type phpunit and select the first option with the “settings” next to it.

Step 2:

Once the settings screen pulls up we should already be at the phpunit section. If not just type phpunit in the search bar at the top left. On this screen you will need to input 2 variables to get your tests working:

C:\wamp64\www\project-name\vendor\autoload.php

C:\wamp64\www\project-name\phpunit.xml

The final result should look like the snapshot below:

phpstorm-tests

Step 3:

Now we are ready to run our tests. To do this you can hit shift + f10 or you can go to the top nav bar and select “run > run all”.

Other helpful notes:

-control f5 will run the most recent test again
-alt + shift + f10 will run all the tests. This is helpful if you have only been running one specific test and would like to go back to running all tests