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:
Thomas Ploch 2011-05-29 12:32:30 +02:00
parent 85c505fd4f
commit a80d82e4a0
3 changed files with 16 additions and 2 deletions

View file

@ -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;
}

View file

@ -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);

View file

@ -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);
}
}