PHPUnit "use Composer autoloader" could not parse PHPUnit version output.

I have a remote PHP interpreter set up inside a Docker container (official PHP container) and want to use PhpStorm's inbuilt PHPUnit support, but I am trying to configure it and I am getting this error:

However, if I run `ls -la vendor/phpunit/phpunit/phpunit` from Git bash I can see clearly that the file does exist there:

 

It looks very similar to a question that was asked a few months ago, but I've had all the updates turned on and I'm still having the issue.

Any help would be appreciated.

  • Windows 10 Professional
  • PhpStorm 2017.1.4
2
12 comments

Could you please try the same using latest EAP build?

If that fails also - please upload somewhere an idea.log file for us to inspect

0
Avatar
Permanently deleted user

Having this same problem.

PhpStorm 2017.2
Build #PS-172.3317.83, built on July 18, 2017
JRE: 1.8.0_152-release-915-b5 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.5

idea.log file https://gist.github.com/nicholascloud/fc82fc4f541217f5c22343a2a7a8d48d

0

Hi Dmitry,

I have just got round to using the EAP build. I can confirm that this issue is the same on this too.

Please see attached screenshot and log file.

Hopefully we can get this resolved.

Cheers,

Greg.

 

Here is my log file: http://paste.ubuntu.com/25215586/

1

As far as I understand, you guys have Docker running in a VM, and PhpStorm is running in Windows.
It does not work this way, volume mappings do not go through the Docker API URL.
You need to share the project folder with the virtual machine, so you could set volume mappings between the container and the VM.

Just an example of how it's set up for me.

Background: I've created a shared folder between the Windows machine and the VirtualBox VM, the whole profile dir is shared:

C:\Eugene.Morozov\ : /media/sf_emor/

After you do a similar thing, please check that these shares are actually browseable in the VM, there definitely may be some permission issues.

So, here:

1. This mappings shows PhpStorm how each file in the project corresponds to each file in the container

2. This is a path blindly inherited from the field below, probably we'll get rid of it

3. This shows how exactly Docker should map folders between the container and the VM

After that, you should successfully get your PHPUnit version.

0
Avatar
Permanently deleted user

@Eugene, I am not using Docker or running a VM. My project is local, and I am running unit tests locally.

0

Nicholas, I was looking at the Greg's screenshots, they clearly show that 1) he is using Docker 2) Docker is running in a VM / on some other server.
You said you're having the same issue, but according to this new information, you are not.

Please use a separate thread for your issue (so this one won't be filled with unnecessary information), or, better, create a support case, we'll help you:
https://intellij-support.jetbrains.com/hc

0

Thanks for your reply @Eugene.

I understand where you're coming from, but the reason I consider this to be a bug with PHPStorm is for two reasons:

1) PHP Storm gives me this option to pick from. See screenshot below. If docker wasn't intended to work like this, then why is this option here?

2) Within PHP Storm, I can use all of the other "dockerised" services, such as Composer (which I do not have installed at all - it's all run through docker containers). I have no versions of PHP, Composer or PHPUnit installed on my local machine (or any programming language/tool for that matter), as I use docker for everything. For instance, I have a bash alias of `php` set to `docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:7.0-cli` so I can run local scripts in the terminal. Same for composer, and PHPUnit. Running `vendor/bin/phpunit` in a bash terminal executes my tests fine, so I can't work out why I'm having this issue with PHP Storm.

Also, I'm not sure if this makes much difference, but I'm running Docker using Hyper-V, so there is no VM running here - all native Windows API calls.

0

For those who have found this thread from Google, I can share how I solved this issue myself. Unlike when setting other Dockerised tools (such as Composer, Behat, etc.), the absolute path to the phpunit binary within the Docker container must be provided.

8
Avatar
Permanently deleted user

@Greg thank you for that post, @Eugene thanks for the suggestion to check the Docker path mappings.

Somehow, PhpStorm managed to muck up the Docker path mappings after an upgrade and reverted them to /opt/project (I work out of /data)

I'd blame myself except I haven't gone anywhere near those settings in months, and everything stopped working after I upgraded.

0

Thanks @greg,

Now works for me as well on PHP 2019

0

Hey guys, currently dealing with something similar. I mean, I'm capable of detecting PHPUnit within the docker  itself, but it seems that my DB_CONNECTION can't be found. I must say that my php application and my database service run in different containers but in the same docker. They eventually share the same network. I am capable of running my application through the browser so the issue actually is happening within my PHPStorm setup.

Thing is that my `.env` file  has somethimg like `DB_HOST=db`, so when PHP runs through the CLI I get this error:

```

Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for db failed: Name or service not known (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')

```

 

But as I mentioned before, apps runs fine on the browser and PHPUnit is properly setup. This is a laravel app so it will try to run the migration files to connect to the database, but it gets stuck. at this point since it doesn't really find by database host

 

I've even tried this:

 

 

But still won't find the db

0

Hi Renzo Castillo,
As this thread was created several years ago and describes two different cases, I would like to ask you to submit a separate request via Help | Contact Support or at https://youtrack.jetbrains.com/newIssue?project=WI.

Please share your Docker setup, a screenshot from Settings | PHP, and also logs from Help | Collect Logs and Diagnostic Data along with the already provided details.

0

Please sign in to leave a comment.