packagist saloonphp/saloon v0.4.0
Version v0.4.0 - Mocking 🚀

latest releases: v3.x-dev, v3.10.0, v3.9.1...
2 years ago

Mocking for Laravel/SDKs

This release includes mocking for both Laravel and PHP applications. See more in the README. Here's a little snippet:

$mockClient = new SaloonMockClient();
$mockClient->addResponse(new MockResponse($data, 200, $headers));
$mockClient->addResponse(new MockResponse($data, 500, $headers));

$response = (new SaloonRequest)->send($mockClient); // 200
$response = (new SaloonRequest)->send($mockClient); // 500

Here's an example of how it could be implemented

$sdk = new ForgeSdk($token, $saloonMockClient);
$sdk->getServers(); // Internally sends $saloonRequest->send($this->mockClient);

Other Changes

  • Added new HasBody plugin for custom request data like XML.
  • Added Macroable trait to SaloonResponse
  • Created a AlwaysThrowsOnErrors plugin
  • Renamed setConfigVariable to setConfig
  • Bug fixes and tidy ups

What's Changed

New Contributors

Full Changelog: v0.3.1...v0.4.0

Don't miss a new saloon release

NewReleases is sending notifications on new releases.