What are you attempting to do? The Http client fake can handle most scenarios, e.g. different responses for different URLs, sequence responses for the same URL - it is all really well documented https://laravel.com/docs/master/http-client#testing
Oct 25, 2020
4
Level 13
How to delete instance of Http::fake() in app?
Since it is not possible to disable Http::fake in multilple usage, i want know how to delete its instance ? I mean:
/** @test */
public function example_test()
{
Http::fake(fn() => ['data' => 1 ]);
$this->app->forgetInstance(Http::class);
// new instance with another data then some actions
Http::fake(fn() => ['data' => 2]);
// another action here usese the second fake data
}
But it uses the first fake method data, How can i override the Http::fake data ?
Level 104
Please or to participate in this conversation.