PHPUnit Support

After you set up PHPUnit, Web IDE greatly helps you to run your tests. Namely, to quickly create test run configuration:

  1. Right-click the desired target: a directory or a PHP file in the Project view, or a test class/method name in the code editor
  2. Choose Run<name> to start or Create<name> to specify additional parameters

That’s it!

XML configuration file

Advanced settings can be specified through PHPUnit configuration file. All the options specified in Web IDE take precedence over those set in configuration file.

Test groups

A test can be tagged as belonging to one or more groups using the @group annotation as shown below.

The test is run if none of the specified groups is excluded and at least one group is included.

Run/Debug Tests

Before you execute tests, please set up PHP home directory (one that contains PHP executable) in Settings | PHP. Debugging is currently available via XDebug. Specify the same debug port in Settings | PHP as in php.ini file (xdebug.remote_port=<port number>).

Test results window

You can easily navigate from tests results tree and stack trace to the corresponding source code location.

When debugging your tests you get all the features, such as watches, expressions evaluation, etc. You can have several debug sessions simultaneously.

All of these features will be available since next EAP.

Test with pleasure!

This entry was posted in Cool Feature, PhpStorm and tagged , , , . Bookmark the permalink.
  • Bill


    Can you provide some information about unit testing Zend Framework applications within phpstorm?

  • isidromerayo

    I try PHPUnit but it isn’t work with annotations @test

    * @test
    public function doSomething() {

    message is: “No test found”

    Testing started at 10:10 …
    Executing tests
    Empty test suite.

  • Lera

    Does it work without annotation @test, but with method renamed to testDoSomething() ?

  • Mike

    I’m having the same trouble, I renamed my test method like suggested and still having the same issue.

  • Torsten

    I have a bootstrap with the autoloader in the xml configuration, but phpStorm doesn’ seem to use them.
    Any ideas anybody ?

  • Diego Oliveira

    there is a way to run the unit tests using a phing target?


  • leneshka

    Hi, Diego!

    Create Phing build file with target with PHPUnit task . It can be run from editor (Run Build File context menu action), or it can be added to Phing Explorer (Add as Phing file context menu action) and later run from there.