Search by

kode4 / slim-foundation-testing

kode4

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

Issues

pkg:composer/kode4/slim-foundation-testing

Statistics

Installs: 16

Dependents: 2

Suggesters: 0

Stars: 0

v0.1.2 2026-12-01 19:29 UTC

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.

ClassUse
IntegrationTestCaseIntegration 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().
TestAuthenticatorReplaces the session authenticator in tests: the identity comes from a request header (headerValue()).
ContractAssertChecks a response against the committed OpenAPI contract; call useContract() once in tests/bootstrap.php.
AccessTestCaseEvery route has a guard, only the listed routes are public, every other route answers 401 anonymously. Extend it with kernel() and publicRouteList().
ContractTestCaseThe committed contract/openapi.json is what the code generates.
SettingKeyTestCaseEvery 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.