diff --git a/CHANGELOG.md b/CHANGELOG.md index a510156..e440ce6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- The `--force-production` editor test no longer depends on test order. Switching the app to + `production` turns off Laravel's fakeable prompt fallback, so run alone (as the mutation job + can) the editor rendered real prompts with no TTY and `select()` threw + `NonInteractiveValidationException: Required.` The test now enables the fallback itself. + ### Changed - `illuminate/bus` is now declared in `require` at `^13.0`. `src/` imports it, and it was only arriving transitively. diff --git a/tests/Feature/TuiTest.php b/tests/Feature/TuiTest.php index 4f2141b..633cd52 100644 --- a/tests/Feature/TuiTest.php +++ b/tests/Feature/TuiTest.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use Laravel\Prompts\Prompt; use Simtabi\Laranail\EnvKit\Headless\Facades\EnvKit; use Simtabi\Laranail\EnvKit\Headless\Tests\TestCase; use Simtabi\Laranail\EnvKit\Headless\Contracts\EnvKitInterface; @@ -102,6 +103,15 @@ $this->app['env'] = 'production'; $this->app->forgetInstance(EnvKitInterface::class); + // Leaving the testing environment turns off runningUnitTests(), which is what + // makes Laravel route prompts through its fakeable fallback. Without it the + // command renders real prompts, which read STDIN and, with no TTY, fall back + // to the empty default: select() then throws NonInteractiveValidationException. + // The fallback flag is sticky (fallbackWhen ORs), so this only passed when an + // earlier test had already set it -- and failed when run alone or reordered, + // as the mutation job does. Set it here so the test stands on its own. + Prompt::fallbackWhen(true); + $this->artisan('laranail::env-kit.edit', ['--force-production' => true]) ->expectsQuestion('Choose a key or action', 'A') ->expectsQuestion('Edit [A]', 'Edit value')