Permalink
Browse files

Added short plugin alias in shells

  • Loading branch information...
robertpustulka committed Jan 16, 2015
1 parent 3078a1e commit dedb2e4191f7ed8b9104953d2a1801308029a3c7
@@ -246,6 +246,11 @@ protected function _getShell($shell) {
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
@@ -427,6 +427,14 @@ public function testGetShell() {
$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);
}
/**
@@ -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');
}
}

0 comments on commit dedb2e4

Please sign in to comment.