PHP code example of jonpurvis / lawman
1. Go to this page and download the library: Download jonpurvis/lawman library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jonpurvis / lawman example snippets
test('connector')
->expect('App\Http\Integrations\Integration\Connector')
->toExtend('Saloon\Http\Connector')
->toUse('Saloon\Traits\Plugins\AcceptsJson')
->toUse('Saloon\Traits\Plugins\AlwaysThrowOnErrors');
test('connector')
->expect('App\Http\Integrations\Integration\Connector')
->toBeSaloonConnector()
->toUseAcceptsJsonTrait()
->toUseAlwaysThrowOnErrorsTrait();
test('request')
->expect('App\Http\Integrations\Integration\Requests\Request')
->toExtend('\Saloon\Http\Request')
->toImplement('Saloon\Contracts\Body\HasBody')
->toUse('Saloon\Traits\Body\HasFormBody')
->toUse('Saloon\Traits\Plugins\AcceptsJson');
test('request')
->expect('App\Http\Integrations\Integration\Requests\Request')
->toBeSaloonRequest()
->toSendPostRequest()
->toHaveFormBody()
->toUseAcceptsJsonTrait();
test('connector')
->expect('App\Http\Integrations\Integration\Connector')
->toBeSaloonConnector()
->toUseCertificateAuthentication()
->toUseTokenAuthentication();
test('request')
->expect('App\Http\Integrations\Integration\Requests\Request')
->toBeSaloonRequest()
->toSendPostRequest()
->toUsePagedPagination()
->toHaveCaching()
->toHaveRateLimits()
test('connector')
->expect('App\Http\Integrations\Integration\Connector')
->toBeSaloonConnector()
->toBeTriedAgainOnFailure(tries: 3)
->toHaveRetryInterval(retryInterval: 1500)
->toUseExponentialBackoff()
test('connector')
->expect('App\Http\Integrations\Integration\Connector')
->toBeSaloonConnector()
->toSetConnectTimeout(connectTimeout: 30)
->toSetRequestTimeout(requestTimeout: 60)
->toUseExponentialBackoff()