Skip to content

Commit

Permalink
Merge pull request #1388 from hydephp/update-composer-dependencies
Browse files Browse the repository at this point in the history
Update Composer dependencies hydephp/develop@2a50b82
  • Loading branch information
github-actions committed Oct 19, 2023
1 parent f20115f commit ff22637
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
21 changes: 21 additions & 0 deletions src/Console/Commands/VendorPublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use function realpath;
use function sprintf;
use function str_replace;
use function Laravel\Prompts\select;

/**
* Publish any publishable assets from vendor packages.
Expand Down Expand Up @@ -42,6 +43,26 @@ public function handle(): void
ServiceProvider::$publishGroups = $originalGroups;
}

/**
* Our child method only uses the select function, instead of the search one.
*/
protected function promptForProviderOrTag(): void
{
$choices = $this->publishableChoices();

$choice = select(
"Which provider or tag's files would you like to publish?",
$choices,
scroll: 15,
);

if ($choice == $choices[0]) {
return;
}

$this->parseChoice($choice);
}

/**
* Write a status message to the console.
*
Expand Down
17 changes: 14 additions & 3 deletions tests/Feature/Commands/VendorPublishCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public function test_command_prompts_for_provider_or_tag()

$this->artisan('vendor:publish')
->expectsChoice('Which provider or tag\'s files would you like to publish?', 'Tag: example-configs', [
'<comment>Publish files from all providers and tags listed below</comment>',
'<fg=gray>Provider:</> ExampleProvider',
'<fg=gray>Tag:</> example-configs',
'All providers and tags',
])
->assertExitCode(0);
}
Expand All @@ -60,7 +60,7 @@ public function test_unhelpful_publishers_are_removed()

$this->artisan('vendor:publish')
->expectsChoice('Which provider or tag\'s files would you like to publish?', 'Tag: example-configs', [
'<comment>Publish files from all providers and tags listed below</comment>',
'All providers and tags',
])->assertExitCode(0);
}

Expand All @@ -73,11 +73,22 @@ public function test_config_group_is_renamed_to_be_more_helpful()

$this->artisan('vendor:publish')
->expectsChoice('Which provider or tag\'s files would you like to publish?', 'Tag: vendor-configs', [
'<comment>Publish files from all providers and tags listed below</comment>',
'All providers and tags',
'<fg=gray>Tag:</> vendor-configs',
])->assertExitCode(0);
}

public function test_can_select_default()
{
ServiceProvider::$publishes = [];
ServiceProvider::$publishGroups = [];

$this->artisan('vendor:publish')
->expectsChoice('Which provider or tag\'s files would you like to publish?', 'All providers and tags', [
'All providers and tags',
])->assertExitCode(0);
}

public function test_status_method()
{
$command = new StatusMethodTestClass($this->createMock(Filesystem::class));
Expand Down

0 comments on commit ff22637

Please sign in to comment.