Added short plugin alias in shells

This commit is contained in:
Robert 2015-01-16 14:30:28 +01:00
parent 3078a1eb52
commit dedb2e4191
3 changed files with 46 additions and 0 deletions

View file

@ -246,6 +246,11 @@ class ShellDispatcher {
App::uses('AppShell', 'Console/Command');
App::uses($class, $plugin . 'Console/Command');
if (!class_exists($class)) {
$plugin = Inflector::camelize($shell) . '.';
App::uses($class, $plugin . 'Console/Command');
}
if (!class_exists($class)) {
throw new MissingShellException(array(
'class' => $class

View file

@ -427,6 +427,14 @@ class ShellDispatcherTest extends CakeTestCase {
$Dispatcher = new TestShellDispatcher();
$result = $Dispatcher->getShell('TestPlugin.example');
$this->assertInstanceOf('ExampleShell', $result);
$Dispatcher = new TestShellDispatcher();
$result = $Dispatcher->getShell('test_plugin');
$this->assertInstanceOf('TestPluginShell', $result);
$Dispatcher = new TestShellDispatcher();
$result = $Dispatcher->getShell('TestPlugin');
$this->assertInstanceOf('TestPluginShell', $result);
}
/**

View file

@ -0,0 +1,33 @@
<?php
/**
* Short description for file.
*
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.TestApp.Plugin.TestPlugin.Console.Command
* @since CakePHP(tm) v 1.2.0.7871
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
/**
* Class TestPluginShell
* @package Cake.Test.TestApp.Plugin.TestPlugin.Console.Command
*/
class TestPluginShell extends Shell {
/**
* main method
*
* @return void
*/
public function main() {
$this->out('This is the main method called from TestPlugin.TestPluginShell');
}
}