mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Adding backwards compatible plugin syntax.
Thie got lost during 2.0, and it inflecting only the shell name is kind of bad.
This commit is contained in:
parent
bad819773e
commit
7a4aa401d1
2 changed files with 6 additions and 0 deletions
|
@ -206,6 +206,7 @@ class ShellDispatcher {
|
||||||
protected function _getShell($shell) {
|
protected function _getShell($shell) {
|
||||||
list($plugin, $shell) = pluginSplit($shell, true);
|
list($plugin, $shell) = pluginSplit($shell, true);
|
||||||
|
|
||||||
|
$plugin = Inflector::camelize($plugin);
|
||||||
$class = Inflector::camelize($shell) . 'Shell';
|
$class = Inflector::camelize($shell) . 'Shell';
|
||||||
|
|
||||||
App::uses('Shell', 'Console');
|
App::uses('Shell', 'Console');
|
||||||
|
|
|
@ -129,6 +129,7 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function tearDown() {
|
public function tearDown() {
|
||||||
|
parent::tearDown();
|
||||||
CakePlugin::unload();
|
CakePlugin::unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,6 +400,10 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$result = $Dispatcher->getShell('sample');
|
$result = $Dispatcher->getShell('sample');
|
||||||
$this->assertInstanceOf('SampleShell', $result);
|
$this->assertInstanceOf('SampleShell', $result);
|
||||||
|
|
||||||
|
$Dispatcher = new TestShellDispatcher();
|
||||||
|
$result = $Dispatcher->getShell('test_plugin.example');
|
||||||
|
$this->assertInstanceOf('ExampleShell', $result);
|
||||||
|
|
||||||
$Dispatcher = new TestShellDispatcher();
|
$Dispatcher = new TestShellDispatcher();
|
||||||
$result = $Dispatcher->getShell('TestPlugin.example');
|
$result = $Dispatcher->getShell('TestPlugin.example');
|
||||||
$this->assertInstanceOf('ExampleShell', $result);
|
$this->assertInstanceOf('ExampleShell', $result);
|
||||||
|
|
Loading…
Add table
Reference in a new issue