Lawman is a Pest PHP plugin that makes adding arch tests to your application for your API integrations easy, with a set of Saloon Expectations!
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>This weekend I worked on something new and shiny for SaloonPHP. I'd like to introduce you to Lawman.
— Jon Purvis (@JonPurvis_) February 14, 2024
Lawman is a @pestphp plugin that makes adding arch tests to your application for your API integrations easy, with a set of Saloon Expectations!https://t.co/WUIGnHriNo
✨🤠
It is already possible to write architecture tests for Saloon with PestPHP, but Lawman aims to make it quicker to write and easier to read. Take this example of a connector arch test with and without Lawman:
// Without Lawman
test('connector')
->expect('App\Http\Integrations\Integration\Connector')
->toExtend('Saloon\Http\Connector')
->toUse('Saloon\Traits\Plugins\AcceptsJson')
->toUse('Saloon\Traits\Plugins\AlwaysThrowOnErrors');
// With Lawman
test('connector')
->expect('App\Http\Integrations\Integration\Connector')
->toBeSaloonConnector()
->toUseAcceptsJsonTrait()
->toUseAlwaysThrowOnErrorsTrait();
You can see examples and a complete list of expectations available in Lawman by checking out the plugin documentation page in the Saloon docs.
The post Add Architecture Tests to Saloon API Integrations with Lawman appeared first on Laravel News.
Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.