IntelliJ IDEA 2016.3 Help

Create New PHPUnit Test

File | New | PHPUnit Test
Project tool window | Context menu of a class | New | PHPUnit Test

Use this dialog to configure generation of PHPUnit test class stubs.

The dialog box is available when the PHPUnit tool is installed on your machine and enabled in IntelliJ IDEA. For more information, see http://www.phpunit.de/manual/current/en/installation.html and Enabling PHPUnit Support.

ItemDescription
Class To Test In this area, specify the production class to generate a test class for. Type the fully qualified name of the class in the Fully Qualified Name text box. The specified name will be used to propose the Test Class Name. To use completion, press Control+Space and choose the relevant production class from the pop-up list.
Test Class
  • Name: in this text box, specify the name of the test class to generate. IntelliJ IDEA automatically composes the name from the production class name as follows: <production class>Test.php.
  • Namespace: in this text box, specify the namespace the test class will belong to. IntelliJ IDEA completes the namespace automatically based on the value of the Directory text box. When the Directory text box is changed, the value of the Namespace text box is changed accordingly. To use completion, press Control+Space and choose the relevant namespace from the pop-up list.
  • Directory: in this text box, specify the directory where the file with the test class will be stored. By default, it is the directory where the production class is stored. To specify another folder, click the Browse button and choose the relevant folder in the dialog box that opens. To use completion, press Control+Space and choose the relevant folder from the pop-up list.
  • File Name: in this text box, specify the name of the file that will be created for the test class definition. By default, the name is the same as the test class name. However, if several production classes are defined in one single file, for each generated test class IntelliJ IDEA will create a separate file.

See Also

Last modified: 21 March 2017