diff --git a/src/Illuminate/Console/Scheduling/ScheduleTestCommand.php b/src/Illuminate/Console/Scheduling/ScheduleTestCommand.php index 0e9001449e9b..9fe44790c564 100644 --- a/src/Illuminate/Console/Scheduling/ScheduleTestCommand.php +++ b/src/Illuminate/Console/Scheduling/ScheduleTestCommand.php @@ -2,8 +2,8 @@ namespace Illuminate\Console\Scheduling; +use Illuminate\Console\Application; use Illuminate\Console\Command; -use Illuminate\Support\Str; class ScheduleTestCommand extends Command { @@ -51,7 +51,11 @@ public function handle(Schedule $schedule) } if (! empty($name = $this->option('name'))) { - $matches = array_filter($commandNames, fn ($commandName) => Str::endsWith($commandName, $name)); + $commandBinary = Application::phpBinary().' '.Application::artisanBinary(); + + $matches = array_filter($commandNames, function ($commandName) use ($commandBinary, $name) { + return trim(str_replace($commandBinary, '', $commandName)) === $name; + }); if (count($matches) !== 1) { return $this->error('No matching scheduled command found.');