laravel-bir-regon

← Documentation

Testing

The package is tested independently with Pest and Orchestra Testbench. Laravel 12 runs on Testbench 10, while Laravel 13 runs on Testbench 11. The suite does not require a fresh Laravel application, the PMS application, a database, or any PMS-specific dependency.

Install development dependencies

From the package repository:

composer install

Isolated test suite

Run the default test suite with:

composer test

These tests use local fakes and never perform network requests. The live sandbox test group is explicitly excluded from the default PHPUnit configuration.

Code quality

Run static analysis and formatting with:

composer analyse
composer format

Validate the Composer package metadata with:

composer validate --strict

Compatibility matrix

The isolated suite is designed to cover:

Before a release, also validate Composer metadata, code style, static analysis, and dependency security advisories. Keep the live GUS sandbox suite separate from isolated checks because it depends on an external service.

GUS sandbox tests

The opt-in integration suite sends real requests to the official GUS test environment:

composer test:sandbox

It verifies:

The suite uses the public sandbox key documented by gusapi/gusapi. You may override it for the current command:

BIR_SANDBOX_API_KEY=your-test-key composer test:sandbox

Use a test key only. Never expose a production BIR key in source control, test output, or a public CI configuration.

The integration suite calls BirRegon::sandbox(). It never changes the production client configuration or sends BIR_API_KEY to the test endpoint.

Sandbox tests depend on an external service and mutable test data. They are useful as an integration check but should not replace the isolated suite.

Testing consuming applications

Application code can depend on BirClientInterface instead of the concrete client. Replace that binding with a fake in the test application’s service container before resolving BirRegonService:

use cieplik206\BirRegon\BirClientInterface;

$this->app->singleton(
    BirClientInterface::class,
    FakeBirClient::class,
);

The fake must implement the public client contract. This keeps application tests deterministic and prevents accidental calls to GUS.

Continue with Extending the package.