Testing PHP Applications
This feature is supported in the Ultimate edition only.
The topics in this part provide guidelines in PHP-specific unit testing procedures. For general information on testing in IntelliJ IDEA, see the section Testing.
IntelliJ IDEA supports unit testing of PHP applications through integration with the PHPUnit tool.
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.
To create and run unit tests on PHP applications, perform the following general steps:
- Enable PHPUnit support.
- 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.
- Create a run configuration:
- To run unit tests locally, create a PHPUnit configuration.
- To run unit tests on a remote server, create a PHPUnit by HTTP configuration.
- Launch unit tests by clicking the Run toolbar button 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 the Debug toolbar button . For details, see PHP Debugging Session.