1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-08-06 06:54:03 +00:00

handle 0 and empty $_ENV differently

This commit is contained in:
Samuel Stancl 2026-06-28 18:49:00 -07:00
parent 4f2c4528a4
commit 6806871993
No known key found for this signature in database
GPG key ID: BA146259A1E16C57

View file

@ -374,14 +374,19 @@ test('migrate fresh command only shows migration output when run with the verbos
// so we cannot easily test commands without -v. To work around that, we temporarily // so we cannot easily test commands without -v. To work around that, we temporarily
// override $_ENV['SHELL_VERBOSITY'] immediately before executing the command. If this // override $_ENV['SHELL_VERBOSITY'] immediately before executing the command. If this
// ever stops working, try also overriding the value in $_SERVER and putenv(). // ever stops working, try also overriding the value in $_SERVER and putenv().
$originalVerbosity = $_ENV['SHELL_VERBOSITY'] ?? 0; $emptySentinel = new \stdClass();
$originalVerbosity = $_ENV['SHELL_VERBOSITY'] ?? $emptySentinel;
try { try {
$_ENV['SHELL_VERBOSITY'] = 0; $_ENV['SHELL_VERBOSITY'] = 0;
Artisan::call('tenants:migrate-fresh'); Artisan::call('tenants:migrate-fresh');
$defaultOutput = Artisan::output(); $defaultOutput = Artisan::output();
} finally { } finally {
if ($originalVerbosity === $emptySentinel) {
unset($_ENV['SHELL_VERBOSITY']);
} else {
$_ENV['SHELL_VERBOSITY'] = $originalVerbosity; $_ENV['SHELL_VERBOSITY'] = $originalVerbosity;
} }
}
Artisan::call('tenants:migrate-fresh -v'); Artisan::call('tenants:migrate-fresh -v');
$verboseOutput = Artisan::output(); $verboseOutput = Artisan::output();