lombokclarion/testing

Test helpers for LombokClarion: InMemoryRepository, FakeCommandBus/FakeEventBus, HttpTestCase, ConsoleTestCase, and the ColdStartTest budget check.

Maintainers

Package info

github.com/codinglombok/testing

pkg:composer/lombokclarion/testing

Transparency log

Statistics

Installs: 0

Dependents: 1

Suggesters: 1

Stars: 0

Open Issues: 0

v2.1.0 2026-08-08 17:25 UTC

This package is auto-updated.

Last update: 2026-08-09 13:12:34 UTC


README

Test doubles, HTTP/Console test cases, cold-start budget enforcement.

[READ-ONLY] This is a subtree split of the LombokClarion monorepo.
Do not send pull requests here — contribute to the main repository instead.

Install

composer require --dev lombokclarion/testing

Namespace

LombokClarion\Testing

What's Inside

Class Role
HttpTestCase Boots real container + explicit override() for integration tests
ConsoleTestCase Runs CLI commands and asserts output/exit code
BenchmarkTestCase Measures execution time against a budget
ColdStartTest Fails when cold-start boot exceeds budget (~5ms)
FakeCommandBus Records dispatched commands without handling them
FakeEventBus Records dispatched events without notifying listeners
InMemoryRepository Generic in-memory repository for domain tests

Usage

use LombokClarion\Testing\HttpTestCase;

class WidgetTest extends HttpTestCase {
    public function testCreateWidget(): void {
        $this->override(WidgetRepository::class, new InMemoryRepository());
        $response = $this->post('/api/widgets', ['name' => 'Test']);
        $this->assertStatus($response, 201);
    }
}

// Fake bus (unit test)
$bus = new FakeCommandBus();
$bus->dispatch(new CreateWidget('Gadget'));
$bus->assertDispatched(CreateWidget::class);

// Cold-start test (in CI)
$test = new ColdStartTest(budgetMs: 5.0);
$test->run(); // fails if boot exceeds 5ms

License

Apache-2.0 — see LICENSE in the main repository.