Skip to content

Testing

Arkhein uses Pest as its primary testing framework. Our goal is to maintain a high-density test suite that validates our architectural non-negotiables.

Getting Started

To run the full test suite, use the following command:

bash
./vendor/bin/pest

Alternatively, you can use the Composer script:

bash
composer test

Repeatable Test Runs

All tests in Arkhein must be repeatable. This is particularly important for our persistence layer.

  • Isolation: Each test run must use a clean, isolated database for the nativephp connection.
  • SSOT Integrity: Tests must verify that knowledge is correctly persisted to the nativephp SQLite connection.
  • Vektor Mocking: When possible, mock Vektor interactions in unit tests to avoid dependency on a local binary index unless the test explicitly targets the MemoryService.

Invariants

  • Zero-Ghost Data: Tests must fail if any model is written to the default connection instead of nativephp.
  • Linting: We use Laravel Pint for linting. composer test runs Pint before executing Pest.

Common Failures

Non-Deterministic Tests

Ensure your tests do not depend on existing local data. Always use factories or seeders to prepare your test environment.

Connection Mismatch

If a test fails with "Table not found," verify the model is correctly configured to use the nativephp connection and that the migrations for that connection have been run.