-
-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHPStorm remote docker-compose based PHP interpreter configuration for integration testing #21
Comments
I did some testing what the effect of removing the leading A hardcoded complete path in turn means the project can't be moved to another location on the disk, but setting the environment variable to @davidalger would you consider a PR to the |
Interesting: the "official" Magento devbox tells users to configure setting up the PHP interpreter as a regular remote php interpreter over ssh. |
@Vinai I used docker image to setup interpreter and it worked for me perfectly. |
@dani97 Care to share details of how you set it up? |
first configure docker service https://www.jetbrains.com/help/phpstorm/docker.html |
Thanks for the info, it's been so long and a lot of work has been done on Warden, I'll try again soon. |
@Vinai @Elamurugan-Nallathambi, I noticed that in my setup that there is no folder like
|
I fixed the `/opt/project mapping by removing it from the "Docker Container" settings beneath the "Path Mappings". When I add the "Project Root => /var/www/html" path mapping there, the remote interpreter can be executed by PHPStorm. This is good enough for unit tests, but since PHPStorm executes the docker container for each PHP execution, no other containers are linked, and so there is no access to MySQL or Redis and the integration tests can't be run. I think the PHP interpreter will have to be configured using "Docker Compose", but I haven't been able to get that working yet since the docker compse configuration is rather complex with many files having to be included in the right order with the right environment variables being set. |
Problem solved thanks to @lbajsarowicz The merged docker-compose config for a project can be dumped with
Then this configuration can be selected in the PHPStorm settings for a docker-compose remote interpreter. EDIT: I did have to add one path mapping for the PHP interpreter manually: from my local project directory to |
Any chance how to set this up could be added to the official docs? I'm having a heck of a time getting this setup. |
How can I make the remote-interpreter the default? I followed the steps above, but the default PHP local interpreter is still executing. Could someone please explain how to set the remote-interpreter as the default in PhpStorm? |
In order to develop Magento extensions and core patches efficiently I want to be able to run integration tests in PHPStorm.
PHPStorm allows configuration of remote, docker-compose based, PHP interpreters.
Here is what I've done so far:
php-debug
.env
:WARDEN_ENV_NAME
WARDEN_ENV_TYPE
TRAEFIK_DOMAIN
TRAEFIK_SUBDOMAIN
WARDEN_WEB_ROOT
(this one isn't from .env but I thought it might help)With this configuration PHPStorm allows saving the interpreter even though it says it's unable to parse the validation script output.
Nevertheless, PHPStorm allows me to continue, even though PHPStorm can not determine the PHP version.
Then I add a path mapping to the interpreter configuration from
<Project root> -> /var/www/html
manually, however, PHPStorm also read an invalid mapping from the yaml:/usr/local/Cellar/warden/0.1.10/environments/.${WARDEN_WEB_ROOT:-}/pub/media -> /var/www/html/pub/media
It seems PHPStorm doesn't like the config in
magento2.darwin.yaml
:.${WARDEN_WEB_ROOT:-}/pub/media:/var/www/html/pub/media:delegated
Next I changed
.${WARDEN_WEB_ROOT:-}
to${WARDEN_WEB_ROOT:-}
(removed the leading.
) and it indeed allowed PHPStorm to find the PHP interpreter correctly.I'm not sure why the
.
is here, I'll test shortly if warden seems to work without it, too.When I then try to set up a PHPUnit configuration with this remote interpreter, I get the message:
I tried setting the composer autoload.php file path to
vendor/autoload.php
/var/www/html/vendor/autoload.php
/Volumes/CaseSensitive/Workspace/php-sites/m2-training/vendor/autoload.pnp
(my local path because of the path mapping config)No luck. This might be an issue with PHPStorm, I don't know, but it would be wonderful to get integration tests working in the IDE.
The text was updated successfully, but these errors were encountered: