Local Community

Local Classic + PHPUnit + PhpStorm

Hi Clay,

Sorry it’s been a while I got sidetracked but still need to set up automated testing!

Yes the problem still occurs. I’m on local 2.4.6 on Windows 10

Here is a link for the log file - I took a look but nothing obvious stuck out.
https://drive.google.com/file/d/17SAIXT1fC25EzZ6r6JYwkr1GzcwqVXYh/view?usp=sharing

FYI I also tried on my laptop and got exactly the same results

Any help is much aprpeciated
Thanks

I believe I have the same issue, stuck on Provisioning, does not go past that point.
Also I noticed if I force quit after 20min or so and restart and try again the new port when trying to add SSH has incremented by one, i.e from 4033, 4034, 4035 each time I try and you cant change that field.

LBFW 2.4.5
VB 5.2.20

Nov 16, 2018, 11:38 AM GMT+10 - info: [main/docker-machine] checking IP
Nov 16, 2018, 11:38 AM GMT+10 - info: [main/docker-machine] checked IP 192.168.95.100

Nov 16, 2018, 11:38 AM GMT+10 - info: [EnvironmentCustom] Empty /etc/mysql
Nov 16, 2018, 11:38 AM GMT+10 - info: [EnvironmentCustom] Copying MySQL config to container prior to starting.
Nov 16, 2018, 11:38 AM GMT+10 - info: [main/waitForFile] Waiting for  /conf/php/7.1.4/etc/php-fpm.conf da8509b02a193c18fa1fa75689a865fc791c8e5b5508d498b208f009eb84260b
Nov 16, 2018, 11:38 AM GMT+10 - info: [main/docker-router] getRouterContainers()
Nov 16, 2018, 11:38 AM GMT+10 - info: [main/docker-router] teardown()
Nov 16, 2018, 11:38 AM GMT+10 - info: [main/docker-router] Removing router container 76979bc2f905bd7e2da32b48b7789cc587933000a587cd77ef4bc2975ffadec1
Nov 16, 2018, 11:38 AM GMT+10 - info: [main/docker-router] updateProxyManager()
Nov 16, 2018, 11:38 AM GMT+10 - info: [main/docker-router] runContainer()
Nov 16, 2018, 11:38 AM GMT+10 - info: [main/docker-network-manager] removeExistingNetworks
Nov 16, 2018, 11:38 AM GMT+10 - info: [main/docker-network-manager] createNetwork
Nov 16, 2018, 11:38 AM GMT+10 - info: [main/waitForFile] /conf/php/7.1.4/etc/php-fpm.conf exists
Nov 16, 2018, 11:38 AM GMT+10 - info: [main/docker-router] reconnectNetwork()
Nov 16, 2018, 11:38 AM GMT+10 - info: [EnvironmentCustom]  Starting php-fpm  done```

My need wasn’t for PHP unit, but searching if it was possible to connect with SSH to container. And how to do it with security (adding this possibility only for a user with a specific password …)
As I read this tutorial carefully, I have followed Step1 and Step2 and I wonder… Isn’t it dangerous to install OpenSSH-server in a Local By Flywheel container and give the ability to connect to container with root / root ? Anyone discover your Remote Host and Port can connect with SSH and then break everything… isn’t it?
… …
Finally, I tried an SSH connection with an external PC to the one containing LBFW and the result is a connection timed out! So, everything is OK!!! :blush:

I’m also getting the provisioning forever bug (OSX 10.14.3, Local 3.0.4). Is the ports add-on still being maintained?

Just had to do this again in 2019. My working process was:

  1. Download and run this script in my local environment: https://gist.github.com/keesiemeijer/a888f3d9609478b310c2d952644891ba
  2. Follow the steps above, but skip step 3
1 Like

I just ran into this exact same issue today. The only way I was able to fix it was by completely creating a new site and starting over :confused:

Current process:

  1. Set up ports as detailed in step 1 above
  2. open site SSH and run this script: https://gist.github.com/alexstandiford/0728ba7b21caa323a5ecf67c6e98abd2
  3. Restart local
  4. Open site SSH and run this script:
    https://gist.github.com/keesiemeijer/a888f3d9609478b310c2d952644891ba
  5. Start on step 4 - Configure PHPStorm above.

The Ports extension is deprecated, and I don’t see any way to add ports in Local Lightning. Is there any way to use PHPUnit and PhpStorm with Local Lightning?

Sorry I can’t help you get setup with PhpStorm, but the above should help.

Thanks, @afragen, but the part of the process I need help with is setting up PhpStorm.

Have you seen the Xdebug + PhpStorm addon?

Click on your Addon icon in the sidebar and install.

Yes, I am using that add-on already. It lets me run Xdebug, but as far as I can tell it does not give me access to unit tests through PHPUnit, because it needs to connect to a database. That’s why I was asking about setting up ports.

1 Like

I run phpunit via the CLI. The script sets up the database, etc. I know it works on a Mac and likely on Un*x. I don’t run phpunit via the IDE so that might make a difference.

@afragen I’m trying to run phpunit in the IDE on Windows, so I’m trying to do something very different from what you have done.

Hi all (@clay included). I’m running Local by Flywheel v3.3.0 on Windows. I’ve created a site in Local by Flywheel, and would now like to use PHPUnit with it. Are the instructions in this post still the preferred way to do so? The only reason I ask is because when the post was created, this qualifier was added:

Note! This is an involved tutorial! We plan on drastically streamlining the PHPUnit experience with Local in future versions.

Thanks.

This depends on the version of Local you are using. Older versions installed the web/db server in a virtual machine (VirtualBox) while newer versions abandoned the virtual machine for installing the server directly on your native OS.

If you are using the latest and greatest then these instructions won’t work, but you could try @afragen’s recommendation above: Local + PHPUnit + PhpStorm. I haven’t personally tried this method yet.

@wpalchemy - Curious if you ever made headway on this?

I’ve just spent a few minutes investigating. From what I see it looks like Local is similar to a normal WAMP stack under the pretty GUI.

You can find the actual application files at a path something like this:

C:\Program Files (x86)\Local

If you drill down into \resources\extraResources\lightning-services you’ll see the a number of folders representing: mariadb, mysql, nginx, php, and mailhog.

You can find MySQL’s binaries somewhere like:

C:\Program Files (x86)\Local\resources\extraResources\lightning-services\mysql-8.0.16+3\bin\win64\bin

I think one could interact with these directly rather than through Local (though I’m sure that isn’t supported :slight_smile: )…If I dive into it more I’ll post a separate thread as I don’t want to hijack this one.

This is a great article and everything worked for me, but I don’t understand how to, after setting up phpunit and phpstorm, then start testing wordpress-develop. I tried deleting everything in the public folder and then checking out wordpress-develop into the public folder, but then i just get a ton of errors. What location would i checkout wordpress-develop into to get it to work with this article? I’m using Local 3.3.0

Thanks!

After spending weeks of trying to get the new version of Local to actually run PHPUnit in PHPStorm, I finally gave up and reverted back to the docker-based version.

It’s super frustrating that there is no apparent way to do this anymore. I get that it’s local…ish, but the script that runs in the “shell” appears to do some fancy things that are necessary for the environment.

I have managed to get PHPUnit running thanks to @afragen but I’ve hit dead-end after dead-end in trying to get PHPUnit to run inside PHPStorm in this environment.

Does anyone have any advice on how to do this? @clay, perhaps?

My current process is still the same as detailed here: Local + PHPUnit + PhpStorm

I was able to get the ports extension to work, but I had to clone it, and run it directly. You can follow the “developing” directions here to get it to work:

I was pleasantly surprised to find it worked perfectly on 3.2.1

A post was split to a new topic: Local Lightning + PHPUnit + PhpStorm