Skip to end of metadata
Go to start of metadata

Redirection Notice

This page will redirect to in about 2 seconds.


This tutorial describes the procedure for running CakePHP 2 Framework Unit Tests in PhpStorm IDE. A blog post on this topic is available here.

CakePHP2 comes with unit testing support powered by PHPUnit. In addition to the features offered by PHPUnit, CakePHP offers some additional features to make testing easier. Unit tests in CakePHP rely on a custom test runner which can be run in the browser or using the CakePHP console. More information on unit testing with CakePHP can be found on their website.

One issue with CakePHP unit tests is that they rely on the CakePHP test runner. This means that running them directly from PhpStorm is not supported out of the box. The following steps describe how to configure PhpStorm to support the CakePHP test runner.

Configuring PhpStorm Test Runner

  1. Add cakeunit4phpstorm.php in your project root (source available at

  2. Create a test configuration for CakePHP.
    1. Specify test runner options
      Make sure to specify test runner options according to the arguments you would normally use with ./Console/Cake test. These arguments should be in the format --cake{var}={value}.

      For example: run application test named "Sample":

      For example: run core test named "AllTests":

    2. Specify PHP interpreter options
      The -f switch should be specified. The value for this switch is the full path to cakeunit4phpstorm.php.

Example Configurations

The following screenshot is an example unit test configuration which runs all core tests:

The following screenshot is an example unit test configuration which runs the sample test for your app tests:

  • No labels