donatj / mock-webserver

Simple mock web server in PHP for unit testing.
MIT License
130 stars 21 forks source link

Feature: allow to have the server file descriptors or logs available #70

Open esteban-serfe opened 3 months ago

esteban-serfe commented 3 months ago

I'm using this to mock server responses of an API using codeception helper. This is working as expected but I'm looking to have the debug sent into the log file (https://github.com/donatj/mock-webserver/blob/master/src/MockWebServer.php#L77) public so we can ready the output of the process and have it as debug output in the process.

The intent is to be able to showcase that the request was received and the response sent when running the tests in debug mode.

Also is an option to have a callable on the Response() object so we can output on the excecution insted of the previous idea.

donatj commented 3 months ago

I'm not sure I'm entirely understanding, but it seems like you could just serialize your requests and the received responses on your side without a change to the library?

esteban-serfe commented 3 months ago

That's an option I didn't consider.

I wanted to have the data from the process itself to have the security that the request was executed, and just listen to the output.

Will play around with this idea a little more and do some testing locally: If I came to solution will share the MR.