IntelliJ IDEA 12.1.0 Web Help

11.0+

You can write unit tests manually or have test stubs generated automatically based on the PHP classes or files that are subject for testing. IntelliJ IDEA generates test stubs automatically via integration with the Skeleton Generator tool.

In this section:

Prerequisites

Note

  1. The PHPUnit tool is installed on your machine and enabled in IntelliJ IDEA.
  2. The Skeleton Generator tool is installed on your machine.
To enable the Skeleton Generator tool
  1. Open the project settings, click PHP.
  2. Under the PHP node, click PHPUnit, then click Skeleton Generator.
  3. On the Skeleton Generator page, select the Use Skeleton Generator check box.
  4. In the Path to phpunit-skelgen text box, specify the phpunit-skelgen parent folder. Most likely, it is the PEAR folder. Type the path manually or click the Browse button browseButton.png and select the desired folder in the dialog that opens.
  5. To have a PHP script always executed before launching the tool, select the Use bootstrap file check box and specify location of the script in the text box below. Type the path manually or click the Browse button browseButton.png and select the desired folder in the dialog that opens.
To generate a PHPUnit test class stub
  1. In the Project tool window, select the PHP class to create unit tests for.
  2. On the context menu of the selection, choose Generate PHPUnit Test.
  3. In the Generate PHPUnit Test from <selected_class_name> dialog box that opens, specify the name of the test class to be created and the directory to store it in.
  4. In the Bootstrap file, specify the PHP script to be executed before the test, if applicable.

See Also

Procedures:

Reference:

Web Resources: