Testing in PhpStorm

Who said testing your PHP code has to be hard?

Create, manage, execute, monitor, debug, and terminate PHP tests directly within PhpStorm.

Testing frameworks

Generate test class stubs based on selected PHP classes and methods using the PHPUnit, Pest, and Codeception frameworks.

PHPUnit

Run unit tests from a directory, file, or class using the context menu options. PhpStorm supports PHPUnit versions 3.3–10, which you can run locally or on a remote server.

Pest

PhpStorm understands the Pest expectation API, so you can use code completion, find usages, and other coding assistance features when working with Pest assertions and user-defined test methods.

Codeception

Run unit, functional, and acceptance tests locally, on a Vagrant machine, remote interpreter, or Docker. Codeception test framework versions 2.2.0 and later are supported.

Behavior-driven development frameworks

PhpStorm supports both StoryBDD and SpecBDD, so you’re fully equipped to create customer-focused software with human-readable stories.

Behat

Focus on the behavior of your application by specifying feature narratives, their needs, and what they mean.

PHPSpec

Focus on the “how” of software implementation by specifying how your classes will achieve required features.

PhpStorm power-ups

Test runner

A dedicated tab for tests in the Run tool window featuring testing-specific controls. See the detailed output of a test session, track execution, jump to test declaration, view results of previous tests, and re-run only those tests that have failed.

Code coverage

Make sure every necessary line of code is executed during unit testing simulation with PHPUnit and Pest code coverage analysis. Know exactly how much of your code is covered by tests right in the editor, with minimal runtime overhead.

Automated testing

PhpStorm can automatically re-run tests when the affected code is changed. This option is configured for each run/debug configuration and can be applied to a test, test file, folder, or composite selection of tests, depending on the test scope specified in the run/debug configuration.

JetBrains AI

Want to go fully autonomous with tests?

Check out how JetBrains AI Assistant in PhpStorm can automate your PHP unit testing and generate test implementation.

The PHP IDE for Professional Web Developers

Join over 600,000 happy PhpStorm users worldwide!

Download PhpStorm