Test PHP applications
The topics in this part provide guidelines in PHP-specific unit testing procedures. For general information on testing in IntelliJ IDEA, see the section Run tests.
IntelliJ IDEA supports unit testing of PHP applications through integration with the PHPUnit testing framework.
Generally, IntelliJ IDEA runs and debugs PHPUnit tests same way as other applications, by running the run/debug configurations you have created. When doing so, it passes the specified test class, file, or directory to the test runner. You can run unit testing locally and remotely depending on the chosen run configuration.
Install the PHP plugin
This functionality relies on the PHP plugin that should be installed and enabled in your IDE.
The plugin is available only in IntelliJ IDEA Ultimate.
Press Ctrl+Alt+S to open the IDE settings and select
.Switch to the Marketplace tab and use the search field to find the PHP plugin.
Click Install and restart the IDE if prompted.
Create and run unit tests on PHP applications, perform the following general steps:
Write the unit tests to run.
Group the test to distinguish between testing in a production and in your development environment or to enable filtering tests by their authors.
To run PHPunit tests, create a PHPUnit configuration.
To run Behat tests, create a Behat configuration.
To run Codeception tests, create a Codeception configuration.
To run PHPSpec specifications, create a PHPSpec configuration.
Launch unit tests by clicking Run and monitor test results in the Run tool window.
Launch unit tests with coverage by clicking the Run with coverage toolbar button and analyze the test coverage in the Coverage tool window.
Debug unit tests by setting breakpoints where necessary and clicking Debug . For details, see PHP debugging session.