From bc5b04c242c28e5869236978ca40e1f825ea19b5 Mon Sep 17 00:00:00 2001 From: crynobone Date: Wed, 22 Oct 2014 14:07:32 +0800 Subject: [PATCH] [5.0] Illuminate\Foundation\Artisan is no longer needed in after the HTTP Kernel refactors. Signed-off-by: crynobone --- src/Illuminate/Foundation/Artisan.php | 60 ------------------- src/Illuminate/Foundation/Console/Kernel.php | 2 +- .../Providers/ArtisanServiceProvider.php | 4 +- tests/Console/ConsoleApplicationTest.php | 2 + 4 files changed, 5 insertions(+), 63 deletions(-) delete mode 100755 src/Illuminate/Foundation/Artisan.php diff --git a/src/Illuminate/Foundation/Artisan.php b/src/Illuminate/Foundation/Artisan.php deleted file mode 100755 index 8a6115417808..000000000000 --- a/src/Illuminate/Foundation/Artisan.php +++ /dev/null @@ -1,60 +0,0 @@ -app = $app; - } - - /** - * Get the Artisan console instance. - * - * @return \Illuminate\Console\Application - */ - protected function getArtisan() - { - if ( ! is_null($this->artisan)) return $this->artisan; - - $this->app->loadDeferredProviders(); - - $this->artisan = ConsoleApplication::make($this->app); - - return $this->artisan->boot(); - } - - /** - * Dynamically pass all missing methods to console Artisan. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return call_user_func_array(array($this->getArtisan(), $method), $parameters); - } - -} diff --git a/src/Illuminate/Foundation/Console/Kernel.php b/src/Illuminate/Foundation/Console/Kernel.php index 68c19bbb55e5..3bfaf1d3db1b 100644 --- a/src/Illuminate/Foundation/Console/Kernel.php +++ b/src/Illuminate/Foundation/Console/Kernel.php @@ -66,7 +66,7 @@ public function handle($input, $output = null) { $this->app->bootstrapWith($this->bootstrappers); - return (new Artisan($this->app, $this->events)) + return $this->app->make('artisan') ->resolveCommands($this->commands) ->run($input, $output); } diff --git a/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php b/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php index 48257dcc958b..26e8186ce331 100755 --- a/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php +++ b/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php @@ -1,6 +1,6 @@ app->bindShared('artisan', function($app) { - return new Artisan($app); + return new Application($app, $app['events']); }); foreach (array_keys($this->commands) as $command) diff --git a/tests/Console/ConsoleApplicationTest.php b/tests/Console/ConsoleApplicationTest.php index 0c31373a1c44..779115971e96 100755 --- a/tests/Console/ConsoleApplicationTest.php +++ b/tests/Console/ConsoleApplicationTest.php @@ -51,6 +51,8 @@ protected function getMockConsole(array $methods) $app = m::mock('Illuminate\Contracts\Foundation\Application', ['version' => '5.0']); $events = m::mock('Illuminate\Contracts\Events\Dispatcher', ['fire' => null]); + $app->shouldReceive('loadDeferredProviders')->once(); + $console = $this->getMock('Illuminate\Console\Application', $methods, [ $app, $events ]);