Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[5.2] Register console commands from Kernel#13097

Merged
taylorotwell merged 1 commit into
laravel:5.2from
themsaid:register-command-from-kernel
Apr 11, 2016
Merged

[5.2] Register console commands from Kernel#13097
taylorotwell merged 1 commit into
laravel:5.2from
themsaid:register-command-from-kernel

Conversation

@themsaid
Copy link
Copy Markdown
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.

2 participants