Skip to main content
Every change needs a focused programmatic check. Not a full suite run per edit — the specific test that proves the thing you changed does what you say it does.

Commands

The architecture check

composer run test:arch runs the PHPat rules through PHPStan. These cover flow runtime isolation, handler versioning, ID strategy, messaging boundaries and migration isolation. Dependency direction and tenant-aware execution have no PHPat rule, so they are checked in review.
Do not run php artisan test tests/Architecture as the architecture check. Those classes are not PHPUnit TestCases, so the command reports nothing and the boundary goes unverified.
The default PHPUnit run covers PHPat indirectly through tests/Unit/Architecture/MigrationTest.php, which invokes PHPStan. The low-level equivalent is:

What to cover

A node handler should be tested for what it returns, not for what it does internally: the status, the sourceHandle for each outcome, and the stateChanges it produces. Those three are the contract; everything else is implementation. Retry safety deserves its own test. Run execute() twice with the same input and assert the external effect happened once — this is the failure that only appears in production, under load, at the worst time. A data accessor should be tested for supportedKeys() matching what get() actually answers. A key listed but unanswered passes flow validation and fails at runtime. Tenant isolation matters wherever your code touches persistence. A test that sets up two tenants and asserts one cannot see the other’s rows is worth more than several tests of the happy path.

Testing a Solution package

A Solution is not an application: its tests run inside a checkout of Core, against the real application, with the package installed by the composer overlay. Core ships a testing kit for that, under the Fapost\Testing namespace. A Solution’s tests use the kit, Foundation and Laravel — never a use App\…, Database\… or Tests\… class of Core. Those are Core’s internals and change without notice; the kit is what Core keeps working for you.
The testing kit is experimental (see the stability policy): its methods may change in a minor release before 1.0, with a changelog entry. It ships with Core’s development dependencies, so it is present wherever Core is installed with them — locally and in your package’s CI — and absent from production images.
A working example of everything below is the public Hello World Solution.

Bootstrap

PHPUnit has to find Core before the kit can be loaded, so the package’s tests/bootstrap.php locates it — from FAPOST_CORE_PATH, or by walking up from the package to the first directory with artisan and vendor/autoload.php — and hands the rest to the kit:
tests/bootstrap.php
PackageAutoloader::register() maps the autoload and autoload-dev namespaces of your composer.json onto your checkout, ahead of Core’s own autoloader. Your test classes become loadable, and tests run from a git worktree of the package exercise that worktree’s src/. The environment goes in phpunit.xml: both connections on in-memory SQLite and the single-tenant mode, and the optional services off — the settings Core’s own phpunit.xml uses.
phpunit.xml
Run the tests from the package directory with Core’s PHPUnit:

The test case

Extend Fapost\Testing\SolutionTestCase. It boots Core, migrates a fresh database with one tenant, main, renders pages without a Vite manifest, and points the web root at a throwaway directory, so publishing your bundle never touches Core’s public/. Each method that changes what a tenant can see also clears what Core remembers within one request, so the next request in the test sees the change, as a real one would. ActionCallResult carries success, body and errorCode, with assertSucceeded() and assertRefused(string $errorCode). An action of a Solution the tenant has not activated is refused with solution_inactive. What the kit does not wrap is public already: the installed catalog is Foundation’s InstalledSolutionCatalogInterface, the manifest check is php artisan platform:update --validate-only, and your provider is $this->app->getProvider(...).
tests/Feature/HelloWorldSolutionTest.php

In CI

Your package’s CI checks Core out, checks the package out under Core’s packages/ directory, installs Core with the package through the overlay, and runs the tests as above. The Hello World Solution’s workflow does exactly that, against Core’s main and its latest release. The kit is part of Core, so a package is always tested against the kit of the Core it runs in.