PhpStorm 2016.3 Help

PHPUnit

File | Settings | Languages and Frameworks | PHP | PHPUnit for Windows and Linux
PhpStorm | Preferences | Languages and Frameworks | PHP | PHPUnit for OS X


The page is available only when the PHP plugin is enabled. The plugin is bundled with PhpStorm and activated by default. If the plugin is not activated, enable it on the Plugins page of the Settings / Preferences Dialog as described in Enabling and Disabling Plugins.

Use this page to configure the way to launch unit tests of your PHP applications.

ItemDescription
PHPUnit Library In this area, specify where to take the PHPUnit test framework. The available options are:
  • Load from include path: choose this option to have PhpStorm run the PHPUnit from PEAR configured as an include path on the PHP page of the Settings / Preferences Dialog.
  • Use custom loader: choose this option to run the PHPUnit instance installed by the Composer Dependency Manager. The package is retrieved and loaded by the dedicated autoload.php file located in the Vendor folder. Specify the location of the autoload.php file in the Path to script text box. Type the path manually or click the Browse button browseButton and select the file in the dialog box that opens,
  • Path to phpunit.phar: choose this option to run PHPUnit from the .phar archive.
    • If you already have the phpunit.phar archive on your computer, specify its location in the Path to phpunit.phar text box. Type the path manually or click the Browse button browseButton and select the file in the dialog box that opens,
    • If you have no .phar archive on your computer yet, click the Download phpunit.phar ... link to have PhpStorm download it automatically.

      In either case, PhpStorm will load the archive before test execution.

Test Runner In this area, appoint the configuration XML file to use for launching and executing scenarios.

By default, PHPUnit looks for a phpunit.xml configuration file in the project root folder or in the config folder. You can appoint a custom configuration file.

  • Default configuration file: select this check box to specify your own XML configuration file. This file will be later used as default in all PHPUnit run/debug configurations.

    In the text box, specify the location of the configuration file to use. Type the path manually or click the /help/img/idea/2016.3/browseButton.png button and choose the file in the dialog box that opens.

    Clear the check box to have PHPUnit use the phpunit.xml configuration file from the project root folder or from the config folder. If no such file is found, test execution fails, therefore it may be more reliable to specify the configuration file explicitly.

  • Default bootstrap file: select this check box to have PHP script always executed before launching tests. In the text box, specify the location of the script. Type the path manually or click the Browse button browseButton.png and select the desired folder in the dialog that opens.

See Also

Last modified: 1 December 2016