Once you’ve run some tests for the first time, likely the majority will pass, but some will fail. Now here’s where it starts to get even more interesting - not to mention time-saving. One advantage of PhpStorm’s Run panel is how it can compact output, making it easier to read and work with.įor example, if you have a test that asserts if two items were the same, such as two strings, it will hide the output, but let it be displayed in a popup window, as in the screenshot below. The image isn’t big enough to show all of the failed test output, but like most windows, you can scroll through the listed output. In the image above, you can see some of the reasons why some of the tests failed. The panel on the right shows the test output. The panel on the left lists all of the tests that were run categorised based on how the tests were initiated. Regardless of the option that you choose, however, when the tests are run, the Run panel opens (by default at the bottom of your PhpStorm window). In the image above, you can see a right-facing, green arrow next to the test’s signature.Ĭlicking on this opens a context menu specifically for testing, as in the image below.Īs with the previous approaches, you then choose the option which best suits your needs. Running individual tests is a little different, however. If I wanted to run all tests in a single class, I could either right-click on the class file in the project view (as in the image above) or right-click on the tab of an open file, and then choose the desired test option from the context menu that appears.
PHPSTORM 10 HOW TO
In this article, I’m taking that tutorial further by showing how to run tests in PhpStorm. Back on November 3rd, last year, I wrote a tutorial showing how to set up PHP debugging with PhpStorm, Xdebug, and PHPUnit.