-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[11.x] Fix prompting for missing array arguments on artisan command (#…
…50850) * [11.x] Fixed prompting for missing array arguments on artisan command * fixed prompting for missing array arguments on artisan command * fixed testing failure fixed:tests/Console/ConsoleApplicationTest.php * Update src/Illuminate/Console/Concerns/PromptsForMissingInput.php Co-authored-by: Jess Archer <[email protected]> * Maintain array type when prompting for missing array argument --------- Co-authored-by: Jess Archer <[email protected]>
- Loading branch information
1 parent
a98a17b
commit 29acd21
Showing
3 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
tests/Console/Fixtures/FakeCommandWithArrayInputPrompting.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Console\Fixtures; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Contracts\Console\PromptsForMissingInput; | ||
use Laravel\Prompts\Prompt; | ||
use Laravel\Prompts\TextPrompt; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
|
||
class FakeCommandWithArrayInputPrompting extends Command implements PromptsForMissingInput | ||
{ | ||
protected $signature = 'fake-command-for-testing-array {names* : An array argument}'; | ||
|
||
public $prompted = false; | ||
|
||
protected function configurePrompts(InputInterface $input) | ||
{ | ||
Prompt::interactive(true); | ||
Prompt::fallbackWhen(true); | ||
|
||
TextPrompt::fallbackUsing(function () { | ||
$this->prompted = true; | ||
|
||
return 'foo'; | ||
}); | ||
} | ||
|
||
public function handle(): int | ||
{ | ||
return self::SUCCESS; | ||
} | ||
} |