Skip to content
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

[5.2] Register console commands from Kernel #13097

Merged
merged 1 commit into from
Apr 11, 2016
Merged

[5.2] Register console commands from Kernel #13097

merged 1 commit into from
Apr 11, 2016

Conversation

themsaid
Copy link
Member

@themsaid themsaid commented Apr 9, 2016

This PR introduces a method to register console commands:

$this->app['Illuminate\Contracts\Console\Kernel']->registerCommand( Command::class );

One useful use case for this is the ability to register a partial mock of a command to test interactivity:

$command = m::mock('\...\TransCommand[ask]');
$command->shouldReceive('ask')->once()->with('..."')->andReturn('First Name');

$this->app[Kernel::class]->register($command);
$this->artisan('langman:trans', ['key' => 'users.name.first']);

@taylorotwell taylorotwell merged commit c99ba59 into laravel:5.2 Apr 11, 2016
@themsaid themsaid deleted the register-command-from-kernel branch April 11, 2016 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants