php-swagger-test icon indicating copy to clipboard operation
php-swagger-test copied to clipboard

Unable to run successful tests for the repo (PHPStorm 2020.1)

Open pionl opened this issue 4 years ago • 3 comments

Hi,

thank you for the package! I I'm working on few fixes to support my openapi3 documentation and I noticed that I can't run successful tests (connection reset on 127.0.0.1) -- servers are started using provided run configurations.

I was able to fix it by changing 127.0.0.1 to localhost in host ( swagger.json and openapi.json).

PHPStorms binds only localhost (on Mac Catalina), then tests can connect to the servers and run tests. Is it working in your environment if you change it to localhost?

Martin

pionl avatar Apr 20 '20 21:04 pionl

Hello, thank you :)

I am using PHPStorm 2020.1 too on a Linux machine and it works both for localhost and 127.0.0.1. The run configuration shared I am using to test it inside the PHPStorm platform is:

image

I don't remember why I am not using localhost but probably it is related to the Travis CI .

Please double check your configuration just to make sure nothing is wrong there. If is really necessary change to localhost, once you open a PR, the Travis platform will start the build and you can check if it is working fine. If is, It will be my pleasure integrate it to the code.

And remember to add the proper unit tests to the new cases you are adding :)

byjg avatar Apr 21 '20 02:04 byjg

I did not change anything and the settings are same as you provided.

Event I can open localhost:8081 in browser or use curl localhost but tests fails in PHP (using local MacOS PHP interpreter - 7.3).

pionl avatar Jun 15 '20 16:06 pionl

The problem is that in Mac the 127.0.0.1 is not binding when you provide localhost in PHP configuration. The swagger uses 127.0.0.1 but PHP run uses localhost :)

pionl avatar Jun 15 '20 16:06 pionl