PHPUnit on Server + VMWare Player + Windows

I've tried every combination I can think of but just can't get my unit tests to run in PHPStorm using remote server option.
'm using Ubuntu 14.04 on VMWare Player.PHPStorm on Windowns 8.1

In listening mode xdebug works fine within PHPStorm. On command line phpunit -c app runs correctly.

After clicking debug button console displays the following error:

<p>The requested URL /_intellij_phpunit_launcher.php was not found on this server.</p>
<address>Apache/2.4.7 (Ubuntu) Server at 192.168.159.129 Port 80</address>

The file is however on the remote viewer, so I must be doing my mapping wrong.

I tried the in place method from https://dutchweballiance.nl/techblog/the-definitive-remote-debug-and-unittest-with-phpstorm-guide-part-4/ but no luck.

Here  are my current settings. Note: Web Path and Deploy path settings seem  completelt backwards to me, but when I have them the other way I upload a  nested /var/www/html in project root. it goes to the correct place this  way.

Run/Debug Configurations

Untitled-4.png
Untitled-3.png


Untitled-5.png
Untitled-6.png


Thanks if anyone can point me in the right direction or has a setup like this working.
Gary

4 comments
Comment actions Permalink

Hi there,

Purelly from your screenshots -- this may be causing the issue:

  • IDE tries to find helper file _intellij_phpunit_launcher.php (which it uploads automatically) in root folder: "/_intellij_phpunit_launcher.php".
  • But your deployment paths tels that it should be "http://192.168.159.129/var/www/html/jobeet"...


Here I do not understand why do you have "/var/www/html/jobeet" in "web path on server" field.


In any case: do you have SFTP/SSH there (on your VM)? Better use it -- it's easier to use PHPUnit via Remote Interpreters.

0
Comment actions Permalink

You are 100% right. I'm running Symfony and wasn't understanding the way mappings work in PHPStorm. I have adjusted them per your recommendation (And re-read everything I can find on the subject)

I changed server configuration to SFTP. Connects correctly to Remote Host in PHPStorm.

But now I am getting this when I click the debug button:

Testing started at 9:36 AM ...
Uploading test files to Ubuntu SFTP...
Executing tests
Http request failed: HTTP/1.0 500 Internal Server Error
Cleaning up...



- On Deployment server I have Root Path set to / -- not the project directory. Is this correct? Makes remote host viewing uglier for this setup but seems to be how it's supposed to be.


- I am using XML file option on Run/Debug config screen. I have this ponted to the local version of phpunit.xml.dist that Symfony creates




Configuration read from /var/www/html/jobeet/app/phpunit.xml.dist (<--this is the config file when I run in the command line)

- How do I test if phpstorm is reading my phpunit on the server correctly?
Here are the remote settings I have for PHPUnit on my VMWare Player. (It's PHPUnit 4.5, if this matters)
Untitled-3.png

0
Comment actions Permalink

On Deployment server I have Root Path set to / -- not the project directory. Is this correct? Makes remote host viewing uglier for this setup but seems to be how it's supposed to be.

This should be a path that needs to be changed after user is logged in.

For example:

  • if FTP user login points to /var/www/html/jobeet then Root Path is just "/" ..
  • if FTP user login points to /var/www then Root Path should be "/html/jobeet/" ..


At the end of the day -- it's all depends on how your FTP and apache is configured. If configured correctly (FTP points to the site root folder -- like almost all shared hostings etc do) then it will be just "/".

I am using XML file option on Run/Debug config screen. I have this ponted to the local version of phpunit.xml.dist that Symfony creates

That's fine -- IDE should: 1) upload all required files and 2) convert local file paths to remote ones.

Configuration read from /var/www/html/jobeet/app/phpunit.xml.dist (<--this is the config file when I run in the command line)

AFAIK this should point to your local file.

Uploading test files to Ubuntu SFTP...

If you have SFTP and SSH -- then you could use SFTP deployments (not FTP) and then use ordinary "PHPUnit" instead of "PHPUnit on Server". As long as you configure Remote PHP Interpreter (using details from SFTP) and mark your SFTP entry as Default for this project, it all will be executed via CLI on remote server.

Have a read -- it works smoother than "PHPUnit on Server" entries (which is done via Browser) : https://confluence.jetbrains.com/display/PhpStorm/Running+PHPUnit+tests+over+SSH+on+a+remote+server+with+PhpStorm
0
Comment actions Permalink

Andriy, you're the best. I'm getting Green bars and everything in PHPUnit. Can't thank you enough.

0

Please sign in to leave a comment.