-
❓ Folks, what's the "right way"™ in phpunit to assert that the payload to an API looks like what you expect?
-
. @adamwathan had the best solution: Fakes. @adamwathan/1146800745808846848?s=20
-
Currently using "$this->mock()->shouldReceive()->with()->andReturn();" but this feels dirty, as I don't actually write assertions against the payload. (And the Mockery Exceptions are not really helpful when a test fails)
-
Thinking of setting the API client as a singleton, "store" the payload as a public property and then use the property for my assertions in my tests. 🤔 I think I'm missing something here. This can't be the right way…
-
Guzzle's MockHandlers are cool, but only work for responses. (docs.guzzlephp.org/en/stable/testing.html#mock-handler) Maybe I should just write a class which prepares and formats the data.