fix: allow --init without a tests directory (#1939)

* fix: allow --init without a tests directory

Boot aborted before TIA state was registered, and shutdown then
tried to construct the plugin. That hid the real error behind
"State cannot be resolved" on a fresh install.

Closes #1934

* fix: detect --init anywhere in the arguments

Flags before --init were still treated as a normal run and failed when tests/ did not exist.

* fix: drop duplicate Kernel::$booted and share --init check

5.3.1 already gates plugin termination on boot, so the rebase must
not declare $booted again. --init and --init=value now share
HandleArguments::hasArgument, and the success snapshot includes
the new init tests.

* test: fix init suite expectations

Parallel total omitted the four --init tests, which
failed the success snapshot. Rector requires toBeFile().

---------

Co-authored-by: Tiago Santos <tsantos@lynixt.pt>
This commit is contained in:
Tiago Santos
2026-10-26 10:51:56 +00:00
committed by GitHub
parent f730a186ce
commit 7abf68e706
5 changed files with 201 additions and 8 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ test('parallel', function () use ($run): void {
$output = $run('--exclude-group=integration');
$output = implode("\n", array_slice(explode("\n", (string) $output), -10));
$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 27 skipped, 1594 passed (3461 assertions)';
$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 27 skipped, 1598 passed (3482 assertions)';
expect($output)
->toContain("Tests: {$expected}")