If you use
wp_remote_request() or other wrappers for
WP_Http methods in your code, this makes it difficult to test, especially if the remote server may not be reachable from your testing environment. That’s why I created the
WP_HTTP_UnitTestCase to solve this by letting you mock the remote responses.
The usage details are there in the repository’s readme file.
It lets you mock the remote responses coming from the server, and also captures the data that was sent to the remote server so you can check that the correct requests are made.
As I continue to write unit tests for WordPress plugins I create, I think I’ll find this helper useful. I hope you might as well.