Prerequisites
Note
-
The PHPUnit
tool is installed
on your machine
and enabled in IntelliJ IDEA.
-
The Skeleton Generator
tool is installed on your machine.
- Open the project settings, click PHP.
- Under the PHP node, click PHPUnit, then click Skeleton Generator.
- On the Skeleton Generator page, select the Use Skeleton Generator check box.
-
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
and select the desired folder in the Select Path dialog box, that opens.
-
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
and select the desired folder
in the Select Path dialog box, that opens.
- In the Project tool window, select the PHP class to create unit tests for.
- On the context menu of the selection, choose Generate PHPUnit Test.
- 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.
- In the Bootstrap file, specify the PHP script to be executed before the test, if applicable.
