![]() Type the path manually or click and select the desired folder in the dialog that opens. In the field, specify the location of the script. You can also type the path to a bootstrap file to have a PHP script always executed before launching tests. You can appoint a custom configuration file. In the Test Runner area, appoint the configuration XML file to use for launching and executing scenarios.īy default, PHPUnit looks for a phpunit.xml or configuration file in the project root folder. When you click, PhpStorm detects and displays the PHPUnit version. To use it in the current project, make sure a default PHP interpreter is defined. For local configurations, you can download the archive by clicking the provided download link. To run PHPUnit from phpunit.phar, download phpunit.phar, save the archive in the project root folder, and specify the path to it. To use Composer autoloader, specify the path to the autoload.php file in the vendor folder. In the right-hand pane, choose the PHPUnit library installation type: To use PHPUnit with a remote PHP interpreter, choose one of the configurations in the dialog that opens: For more information, refer to Default project CLI interpreters. In local configurations, the default project PHP interpreter is used. On the Test Frameworks page that opens, click in the central pane and choose the configuration type from the list: In the Settings dialog ( Control+Alt+S), go to PHP | Test Frameworks. If the phpunit.xml or configuration file is detected under the project (or subproject) root automatically or specified explicitly during manual configuration, PhpStorm also creates a respective PHPUnit run/debug configuration. You can manually configure the used local or remote PHP interpreter separately for each of the Composer-managed test framework configurations. ![]() PhpStorm detects the installed PHPUnit executable (or executables, if the project has Composer-managed subprojects with a specified PHPUnit dependency) and creates a test framework configuration per each installed PHPUnit executable on the Test Frameworks page. Store the phpunit.xml or configuration file under the project root. In the case of remote PHP interpreters, manual PHPUnit configuration is required. ![]() If you use a local PHP interpreter, PhpStorm performs initial PHPUnit configuration automatically. Integrate PHPUnit with a PhpStorm project Press Alt+Enter and select whether you want to install a specific dependency or all dependencies at once.Ĭlick next to the package record in the composer.json editor gutter to jump to the corresponding Settings page and configure PHPUnit manually. If the Non-installed Composer packages inspection is enabled, PhpStorm will highlight the declared dependencies that are not currently installed. Press Control+Space to get code completion for the package name and version.Ĭlick the Install shortcut link on top of the editor panel. Inside composer.json, add the phpunit/phpunit dependency record to the require or require-dev key. If you only need to run PHPUnit tests and you do not need any coding assistance, you can save phpunit.phar outside the project.ĭownload and install phpunit.phar with Composer If you need full coding assistance in addition to the ability of running PHPUnit tests, store phpunit.phar under the root of the project where PHPUnit will be later used. Download and install phpunit.phar manuallyĭownload phpunit.phar from the PHPUnit Official website and save it on your computer: Download and install PHPUnitīefore you start, make sure Composer is installed on your machine and initialized in the current project as described in Composer dependency manager. Make sure the PHP interpreter is configured in PhpStorm on the PHP page, as described in Configure local PHP interpreters and Configure remote PHP interpreters. PhpStorm supports unit testing of PHP applications through integration with the PHPUnit testing framework.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |