

(Mine is at /Users/dustin/Homestead) though yours might be different depending on your setup. In the “Vagrant Instance Folder” input select your homestead installation folder.Select the + icon at the top left of the screen and click the “remote interpreter” option.(this is where we connect to the Vagrant VM) Click the wrench icon to the right of the “config file” input to set up your interpreter.Check the “Use alternative configuration file” box and add the path to the phpunit.xml file in the root of your Laravel app.You can run specific test classes or specific tests once you are up and running.Setting this as the directory will have PhpStorm run all of the tests within the directory when you run tests. I recommend using the /tests directory in your app.Test scope should have “Directory” selected.Complete the settings here using the directory option.Click the + sign and select PHPUnit to create a new PHPUnit test configuration.In my opinion, there should be some sort of wizard for this configuration.

I’m not sure why PhpStorm makes this so difficult. This process was confusing, to say the least. If you are using a different development environment on your machine, this setup will likely be different for you. On my machine, I use a global Laravel Homestead virtual box with vagrant. There is a video at the bottom of this page if you learn better by screencast.
#Phpstorm xdebug phpunit vagrant how to#
I thought it would be nice for other Laravel developers to see how to set it up and what the most useful features are. If you are new to testing or you haven’t used the testing features available in PhpStorm continue reading to see why I am so excited about its advanced features. However, PhpStorm can make this process much MUCH better! I started testing using PHPUnit in the terminal which is fine. I’m starting to feel the need for a good test suite now that my codebase is growing larger.
