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
- Fix typo in readme by @adil62 in #12
- v0.4.0 - Mocking 🚀 by @Sammyjo20 in #13
New Contributors
Full Changelog: v0.3.1...v0.4.0