donatj / mock-webserver

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

Add DelayResponse support to ResponseStack #56

Closed Jarlakxen closed 1 year ago

Jarlakxen commented 1 year ago

Hi!

I added the capability to honor the DelayedResponse when it is inside a ResponseStack. I'm was trying to test the retry behavior on my app, so I needed to emulate 1 response with high delay than the second one in other to only trigger the timeout in the first one.

donatj commented 1 year ago

Thanks for the PR! I actually ran into a similar issue recently and have been considering rewriting the way the response stacks work from the ground up to fix these sorts of issues.

I'm not sure if my idea is practical though. I'll review this when I get some time on the computer in the next day or so.

donatj commented 1 year ago

Thank you again for the great PR.

My ideas are breaking changes and a ways out whereas this is a very practical fix for the time being. I am very happy to accept this.

donatj commented 1 year ago

It now exists in tab v2.7.0 - https://github.com/donatj/mock-webserver/releases/tag/v2.7.0