mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Added short plugin alias in shells
This commit is contained in:
parent
3078a1eb52
commit
dedb2e4191
3 changed files with 46 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue