Search code examples
phpdockerphpstorm

PhpStorm doesn't read PHP configuration from Docker container


What I want

Run PHPUnit by terminal and configuration in PhpStorm

What I Have

Previous problem

Resolved in HERE - about not finding files

File that running

#!/usr/bin/env bash
# echo "Current working directory: '"$(pwd)"'"
cd $(pwd) && docker run --rm -t -v $(pwd):/var/www -e SYMFONY_ENV=dev ezsystems/php:7.1-v1-dev php $@

Summary

When I run this by terminal:

docker-phpez vendor/bin/phpunit --coverage-text

Everything working correctly.

When I try to run this with configuration of PhpStorm, I get warning that: PHP is not installed.

But running this as remote PHP interpreter, gives me:

docker://ezsystems/php:7.1-v1/php /opt/.phpstorm_helpers/phpunit.php --configuration /var/www/phpunit.xml.dist
Testing started at 17:06 ...
The value $_SERVER['IDE_PHPUNIT_PHPUNIT_PHAR'] is specified, but file doesn't exist '/var/www/vendor/bin/phpunit'

Process finished with exit code 1

Looking like mounting doesn't work.

Question:

  • do you know why? How to fix that?

In previous version of PhpStorm I didn't had any problem with that. Right now, I have 2016.3.2.


Solution

  • After updating PHPStorm to 2017.1.4, what I did:

    • switched to docker configuration
    • phpunit loaded from composer's autoload.php

    Started to working. Still don't know why docker-phpez not working by PHPStorm, but I will stop for now.