kode4 / slim-foundation-testing
Test support for applications on kode4/slim-foundation: an integration test case with rollback, a test authenticator, contract assertions and a recording DBAL driver
Package info
gitlab.com/kode4/packages/slim-foundation-testing
pkg:composer/kode4/slim-foundation-testing
Requires
- php: ^8.4
- kode4/slim-foundation: ^0.1
- opis/json-schema: ^2.6
- phpunit/phpunit: ^12.5.4 || ^13.0
Requires (Dev)
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-12-02 12:42:14 UTC
README
Test support for applications on kode4/slim-foundation; install it with require-dev.
| Class | Use |
|---|---|
IntegrationTestCase | Integration tests against the test database: each test runs in a transaction that is rolled back; http() runs the whole app as a logged-in user with the CSRF headers. Extend it once and name the project's Kernel in kernel(). |
TestAuthenticator | Replaces the session authenticator in tests: the identity comes from a request header (headerValue()). |
ContractAssert | Checks a response against the committed OpenAPI contract; call useContract() once in tests/bootstrap.php. |
AccessTestCase | Every route has a guard, only the listed routes are public, every other route answers 401 anonymously. Extend it with kernel() and publicRouteList(). |
ContractTestCase | The committed contract/openapi.json is what the code generates. |
SettingKeyTestCase | Every setting (the modules' defaults and config/setting.php) has a reader in the project or the library. |
DbalTestTrait, Dbal\* | A recording DBAL driver: SQL tests without a database. |
Source: developed in the monorepo gitlab.com/kode4/slim-foundation
(folder slim-foundation-testing/), released together with kode4/slim-foundation in the same version. The repository
kode4/packages/slim-foundation-testing is a read-only copy made on every release: open issues and merge requests in
the monorepo.
License: MIT.