-
-
Notifications
You must be signed in to change notification settings - Fork 0
Testing
nejcc edited this page Jul 7, 2026
·
1 revision
The SDK uses Laravel's HTTP client, so fake it with Http::fake() in your own
tests.
use Illuminate\Support\Facades\Http;
Http::fake([
'*/oauth20/token' => Http::response(['access_token' => 'tok-123', 'expires_in' => 3600]),
'*/orgs/123/customers' => Http::response(['Rows' => [['CustomerId' => 1]]]),
]);
$rows = Minimax::forOrg(123)->customers()->all()['Rows'];
Http::assertSent(fn ($req) => $req->hasHeader('Authorization', 'Bearer tok-123'));The package itself ships a full test suite (100% line coverage) covering auth,
token caching, the Location-follow, invoice PDF decode, byCode(), org
overrides, error paths, the admin UI and the MCP tools.
composer test| Call | Signature |
|---|---|
| Manager |
forOrg(orgId), client(), resource(slug)
|
| Orgs | orgs()->all() |
| CRUD (all resources) |
all(query), find(id), byCode(code, query), create(data), update(id, data), delete(id)
|
| Invoices | CRUD + action(id, action, rowVersion), issue(id, rowVersion), pdf(id, rowVersion)
|
| Code lists |
vatRates()->byCode('S'), currencies()->byCode('EUR'), countries()->byCode('SI')
|
| Generic | resource('journals')->… |
| Client |
client()->token(), client()->request(method, path, body, query)
|
Minimax SDK