orion-search / testing
In-memory storage, conformance test cases for engine and storage adapters, fault injection and fakes for testing Orion and applications built on it
dev-main / 1.0.x-dev
2026-10-27 18:15 UTC
Requires
- php: >=8.3
- orion-search/core: ^1.0
- phpunit/phpunit: ^12.5
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-27 19:15:58 UTC
README
What a test suite needs to run Orion without an engine or a database, and what every adapter must pass before it ships.
composer require --dev orion-search/testing
use Orion\Adapter\InMemory\InMemoryEngine; use Orion\Orion; use Orion\Registry\EngineRegistry; use Orion\Tenancy\Tenancy; use Orion\Testing\FixedClock; use Orion\Testing\InMemoryStorage; use Orion\Wiring\Config; $graph = Orion::create(new Config( storage: new InMemoryStorage(), engines: new EngineRegistry(memory: new InMemoryEngine()), tenancy: Tenancy::single(), clock: new FixedClock(), ))->graph();
For application tests:
InMemoryStorage, the referenceStorageadapter: Orion's tables over PHP arrays, nothing to install, transactions that roll back, SQL's comparison rules.FixedClock(one instant) andSettableClock(moved withadvance()), for timestamps, leases and grace windows.SettableResolver, a tenant resolver a test switches by hand; with no tenant set it fails, as a request without one must.
For adapter authors, the suites every adapter in this repository passes:
StorageConformanceTestCase: the criteria grammar, identifier and value safety, and the same-connection proof. The outbox row written through the adapter commits and rolls back with an entity row written on the host's own connection, inside the host's own transaction. ImplementcreateStorage(),insertOnHostConnection()andinHostTransaction().EngineConformanceTestCase: schema create, inspect and in-place apply without drift; version-stamped writes and deletes that converge; the neutral query AST with portable semantics; the scoped escape hatch;UnsupportedClausefor every capability reported false. ImplementcreateEngine()andnativeMatchAll().TenancyIsolationTestCase: no query, neutral or native, returns, overwrites or deletes another tenant's document.LifecycleDeterminismTestCaseandFaultInjectionTestCase(withFaultyEngineandFaultyStorage): plan, apply and reindex are reproducible, and a reindex is lossless when the engine or the database dies mid-operation.Equivalence\QueryEquivalenceTestCase: seeded random queries (ORION_SEED) answer as the in-memory oracle does.Endpoint\EndpointFixtureTestCase: a host serves the recordedsearch:endpoint fixtures (fixtures/endpoints) exactly.
How to test an application that uses Orion: the Testing guide.