It is possible to use PHPStorm with DDEV on WSL2 in at least three different ways: Enable Xdebug if you want to debug tests.Test scope (as you wish, by directory or class or whatever).Open Run/Debug configurations and use the " " to add a phpunit configuration.Choose "Path to phpunit.phar" and use /var/For example, for Drupal 9, ddev composer require -dev -with-all-dependencies drupal/core-dev:^9 and ddev composer require -dev phpspec/prophecy-phpunit:^2.Under "Test Frameworks" click the " " to add phpunit (Assumes phpunit is already installed).This part is not done for you by the plugin. Add an entry that maps your project location to /var/ In the main PHP setup dialog, add an entry to the path mappings, as it doesn't correctly derive the full path mapping.In the CLI interpreter "Lifecycle" select "Connect to existing container"., (Command Shift Dot) to show hidden dotfiles. Now back in the "Configure Remote PHP Interpreter" for "Configuration files" use.So "Virtual Machine Path" would be "/var/www/html" and "Local path" would be something like /Users/rfay/workspace/d9 (on macOS) or \\wsl$\Ubuntu\home\rfay\workspace\d9 on Windows using WSL2. In the "Path mappings" of the "Server" you may have to map the local paths (which on WSL2 means /home/.) to the in-container paths, especially if you have mutagen enabled.Create a "server" Choose the appropriate docker provider configured above under Build, Execution, Deployment -> Docker.Use the " " to select "From Docker, Vagrant, VM.".Under File→Settings→PHP (Windows) or Preferences→PHP (macOS), click the "." to the right of "CLI Interpreter".(All you have to do here is click the little telephone to "Start listening for PHP Debug Connections", then ddev xdebug on, then visit a web page and choose the correct mapping from host to server.) This will result in a PhpStorm "Server" with the proper name, normally the same as the FQDN of the project. Set up your project to do normal Xdebug, as described in the Step Debugging section.Under Build, Execution, Deployment -> Docker, set the correct Docker provider, for example "Colima" or "Docker for Mac".(If you're running PhpStorm inside WSL2, there are no special instructions.) In other words, in the "Open" dialog, browse to \\wsl$\Ubuntu\home\rfay\workspace\d9 (in this example). If you're on Windows, running PhpStorm on the Windows side but using WSL2 for your DDEV project, open the project as a WSL2 project.In this example, the project name is "d9" and the site is "d9.ddev.site". Setup Technique (if you aren't using DDEV Integration Plugin) ¶ If you're using WSL2 and running PhpStorm on the Windows side, PhpStorm can't use docker-compose from WSL2, so at least configure Docker Desktop in Settings->General to "Use Docker Compose V2" and use a recent version of Docker Desktop. In Preferences->Build, Execution, Deployment->Docker->Tools, set the docker-compose executable to DDEV's private docker-compose, /.ddev/bin/docker-compose.The only thing it doesn't currently do is set up phpunit, and it doesn't point docker-compose correctly.įor any setup, including the DDEV Integration Plugin: That does almost all of what is discussed here automatically, and works on all platforms. PhpStorm Configuration and Integration ¶ Full Integration with Docker, DDEV, and PhpStorm ¶įor full integration of PhpStorm and DDEV, it's easiest to use the DDEV Integration Plugin or in Preferences -> Plugins -> Marketplace search for DDEV.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |