-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[11.x] Make tests pass on Herd #54171
Conversation
@@ -95,7 +96,7 @@ public static function phpBinary() | |||
*/ | |||
public static function artisanBinary() | |||
{ | |||
return ProcessUtils::escapeArgument(defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan'); | |||
return ProcessUtils::escapeArgument(artisan_binary()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel like we need to introduce artisan_binary()
helper since calling Illuminate\Console\Application::artisanBinary()
would always yield the correct value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return ProcessUtils::escapeArgument(artisan_binary()); | |
return ProcessUtils::escapeArgument(defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Illuminate\Console\Application::phpBinary()
also uses the php_binary()
helper, and this way defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan'
is now only used inside that helper, nowhere else. I would be fine with accepting your commit suggestion (or you can push it yourself), but it feels like a step bakc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this method should return without quote in Laravel 12 and let method that needs it to explicit espace the argument.
Escaping argument is only needed when we providing string
instead of array
to Symfony Process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
artisan_binary()
also returns without quotes, the change on this line doesn't change the output from defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan'
I agree with you that there's further cleanup possible for v12
@@ -68,7 +69,7 @@ public function handle() | |||
if ($this->option('passport')) { | |||
Process::run(array_filter([ | |||
php_binary(), | |||
defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan', | |||
artisan_binary(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
artisan_binary(), | |
\Illuminate\Console\Application::artisanBinary(), |
@@ -133,7 +134,7 @@ protected function installSanctum() | |||
if (! $migrationPublished) { | |||
Process::run([ | |||
php_binary(), | |||
defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan', | |||
artisan_binary(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
artisan_binary(), | |
\Illuminate\Console\Application::artisanBinary(), |
@@ -156,7 +157,7 @@ protected function installReverb() | |||
|
|||
Process::run([ | |||
php_binary(), | |||
defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan', | |||
artisan_binary(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
artisan_binary(), | |
\Illuminate\Console\Application::artisanBinary(), |
@@ -72,7 +73,7 @@ protected function phpBinary() | |||
*/ | |||
protected function artisanBinary() | |||
{ | |||
return defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan'; | |||
return artisan_binary(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return artisan_binary(); | |
return \Illuminate\Console\Application::artisanBinary(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is functionally different since \Illuminate\Console\Application::artisanBinary()
escapes it using ProcessUtils::escapeArgument()
Marking as draft since few tests on Windows are failing. |
@crynobone thank you for reviewing, please let me know if you are looking for any additional changes at this point |
Fix Test Compatibility with Herd by Standardizing Binary Handling
This PR fixes tests that use
PHP_BINARY
and therefore fail when running via Herd.It standardizes the handling of
PHP
andArtisan
binaries via the existingphp_binary
function (orApplication::phpBinary()
for console operations) and the newly addedartisan_binary
function.Key Changes:
artisan_binary
helper inIlluminate\Support\functions.php
to standardize access to the Artisan binary path.artisan_binary
helper, replacing inline checks likedefined('ARTISAN_BINARY')
.Benefits:
Tests have been updated and verified to maintain existing behavior while ensuring compatibility with Herd. This change focuses on improving developer experience in environments using Herd.