fake($callback)); }); } /** * Register a response sequence for the given URL pattern. * * @param string $urlPattern * @return \Illuminate\Http\Client\ResponseSequence */ public static function fakeSequence(string $urlPattern = '*') { $fake = tap(static::getFacadeRoot(), function ($fake) { static::swap($fake); }); return $fake->fakeSequence($urlPattern); } /** * Indicate that an exception should be thrown if any request is not faked. * * @return \Illuminate\Http\Client\Factory */ public static function preventStrayRequests() { return tap(static::getFacadeRoot(), function ($fake) { static::swap($fake->preventStrayRequests()); }); } /** * Stub the given URL using the given callback. * * @param string $url * @param \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface|callable $callback * @return \Illuminate\Http\Client\Factory */ public static function stubUrl($url, $callback) { return tap(static::getFacadeRoot(), function ($fake) use ($url, $callback) { static::swap($fake->stubUrl($url, $callback)); }); } }