mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixed Shell naming from using Inflector::underscore() to Inflector::camelize(). Added small test case for Shell naming. Fixed missing CakePlugin::load() call in ShellTest.
This commit is contained in:
parent
85c505fd4f
commit
a80d82e4a0
3 changed files with 16 additions and 2 deletions
|
@ -467,7 +467,7 @@ class TestTask extends BakeTask {
|
|||
public function getPath() {
|
||||
$path = $this->path;
|
||||
if (isset($this->plugin)) {
|
||||
$path = $this->_pluginPath($this->plugin) . 'tests' . DS;
|
||||
$path = $this->_pluginPath($this->plugin) . 'Test' . DS;
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ class Shell extends Object {
|
|||
*/
|
||||
function __construct($stdout = null, $stderr = null, $stdin = null) {
|
||||
if ($this->name == null) {
|
||||
$this->name = Inflector::underscore(str_replace(array('Shell', 'Task'), '', get_class($this)));
|
||||
$this->name = Inflector::camelize(str_replace(array('Shell', 'Task'), '', get_class($this)));
|
||||
}
|
||||
$this->Tasks = new TaskCollection($this);
|
||||
|
||||
|
|
|
@ -172,6 +172,7 @@ class ShellTest extends CakeTestCase {
|
|||
'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS),
|
||||
'models' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS)
|
||||
), true);
|
||||
CakePlugin::load('TestPlugin');
|
||||
|
||||
$this->Shell->uses = array('TestPlugin.TestPluginPost');
|
||||
$this->Shell->initialize();
|
||||
|
@ -799,4 +800,17 @@ TEXT;
|
|||
TEXT;
|
||||
$this->assertEquals($expected, $result, 'Text not wrapped.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Testing camel cased naming of tasks
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function testShellNaming() {
|
||||
$this->Shell->tasks = array('TestApple');
|
||||
$this->Shell->loadTasks();
|
||||
$expected = 'TestApple';
|
||||
$this->assertEqual($expected, $this->Shell->TestApple->name);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue