Skip to content

Conversation

@clue
Copy link
Owner

@clue clue commented Jan 3, 2026

This changeset adds a new NullRunner stub for integration tests with the new X_EXPERIMENTAL_RUNNER environment variable. This experimental application runner can be used in environments where the application lifecycle is managed externally. It can be useful for integration testing or when embedding the application in other systems.

Note that this runner is not intended for production use and is not loaded by default. You need to explicitly configure your application to use this runner through the X_EXPERIMENTAL_RUNNER environment variable:

$container = new Container([
    // 'X_EXPERIMENTAL_RUNNER' => fn(?string $X_EXPERIMENTAL_RUNNER = null): ?string => $X_EXPERIMENTAL_RUNNER,
    // 'X_EXPERIMENTAL_RUNNER' => fn(bool|string $ACME = false): ?string => $ACME ? NullRunner::class : null,
    'X_EXPERIMENTAL_RUNNER' => NullRunner::class
]);

$app = new App($container);

Likewise, you may pass this runner through an environment variable from your integration tests, see also included PHPT test files for examples.

Builds on top of #295, #294, #292, #289, #288, #287, #236, #224, #44, reactphp/promise#248, and others

@clue clue added this to the v0.18.0 milestone Jan 3, 2026
@clue clue requested a review from Copilot January 3, 2026 20:12
@clue clue added the new feature New feature or request label Jan 3, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new NullRunner stub for integration testing with the experimental X_EXPERIMENTAL_RUNNER environment variable. The NullRunner allows the application lifecycle to be managed externally, making it useful for integration testing scenarios where you want to manually invoke the application instead of running the built-in server.

Key changes:

  • Introduces NullRunner class that implements a no-op __invoke() method for external application lifecycle management
  • Adds integration tests demonstrating NullRunner usage in PHPT format
  • Updates PHPUnit and PHPStan configurations to support PHPT test files

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Runner/NullRunner.php New runner stub that does nothing when invoked, allowing external application lifecycle management
tests/Runner/NullRunnerTest.php Unit test verifying NullRunner returns immediately without invoking the handler
tests/integration/tests/AppStopsWithoutOutputWithNullRunner.phpt Integration test verifying app stops immediately with no output when using NullRunner
tests/integration/tests/AppInvokeIndexReturnsResponse.phpt Integration test verifying app can be manually invoked to handle requests when using NullRunner
tests/integration/public/index.php Updated to configure AccessLogHandler to use /dev/null when running with experimental runner
tests/AppTest.php Added unit test verifying NullRunner integration with App class
src/App.php Updated type hints and documentation references to use more generic callable types
phpunit.xml.dist Added support for .phpt test files and refined integration test exclusions
phpunit.xml.legacy Added support for .phpt test files and refined integration test exclusions
phpstan.neon.dist Added .phpt file extension for static analysis

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@clue clue merged commit 628ec52 into clue:main Jan 4, 2026
74 checks passed
@clue clue deleted the null-runner branch January 4, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant