Skip to content

Commit

Permalink
Fixed Shell naming from using Inflector::underscore() to Inflector::c…
Browse files Browse the repository at this point in the history
…amelize(). Added small test case for Shell naming. Fixed missing CakePlugin::load() call in ShellTest.
  • Loading branch information
Thomas Ploch committed May 29, 2011
1 parent 85c505f commit a80d82e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Console/Command/Task/TestTask.php
Expand Up @@ -467,7 +467,7 @@ public function getOptionParser() {
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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Shell.php
Expand Up @@ -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);

Expand Down
14 changes: 14 additions & 0 deletions lib/Cake/Test/Case/Console/Command/ShellTest.php
Expand Up @@ -172,6 +172,7 @@ public function testInitialize() {
'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();
Expand Down Expand Up @@ -799,4 +800,17 @@ function testWrapText() {
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);
}
}

0 comments on commit a80d82e

Please sign in to comment.