Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix double inflection in bake all <foo>

ViewTask re-pluralizes the model name.  Sometimes this leads to
things like Menuses which is totally wrong.

Fixes #2318
  • Loading branch information...
commit 0f71254fe175c4a67c355cc39633e8a1c65979e4 1 parent 8b3c72f
@markstory markstory authored
View
2  lib/Cake/Console/Command/BakeShell.php
@@ -185,7 +185,7 @@ public function all() {
}
App::uses($controller . 'Controller', 'Controller');
if (class_exists($controller . 'Controller')) {
- $this->View->args = array($controller);
+ $this->View->args = array($name);
$this->View->execute();
}
$this->out('', 1, Shell::QUIET);
View
31 lib/Cake/Test/Case/Console/Command/BakeShellTest.php
@@ -83,21 +83,38 @@ public function testAllWithModelName() {
$this->Shell->View = $this->getMock('ModelTask', array(), array(&$this->Dispatcher));
$this->Shell->DbConfig = $this->getMock('DbConfigTask', array(), array(&$this->Dispatcher));
- $this->Shell->DbConfig->expects($this->once())->method('getConfig')->will($this->returnValue('test'));
+ $this->Shell->DbConfig->expects($this->once())
+ ->method('getConfig')
+ ->will($this->returnValue('test'));
- $this->Shell->Model->expects($this->never())->method('getName');
- $this->Shell->Model->expects($this->once())->method('bake')->will($this->returnValue(true));
+ $this->Shell->Model->expects($this->never())
+ ->method('getName');
+
+ $this->Shell->Model->expects($this->once())
+ ->method('bake')
+ ->will($this->returnValue(true));
- $this->Shell->Controller->expects($this->once())->method('bake')->will($this->returnValue(true));
- $this->Shell->View->expects($this->once())->method('execute');
+ $this->Shell->Controller->expects($this->once())
+ ->method('bake')
+ ->will($this->returnValue(true));
+
+ $this->Shell->View->expects($this->once())
+ ->method('execute');
$this->Shell->expects($this->once())->method('_stop');
- $this->Shell->expects($this->at(0))->method('out')->with('Bake All');
- $this->Shell->expects($this->at(5))->method('out')->with('<success>Bake All complete</success>');
+ $this->Shell->expects($this->at(0))
+ ->method('out')
+ ->with('Bake All');
+
+ $this->Shell->expects($this->at(5))
+ ->method('out')
+ ->with('<success>Bake All complete</success>');
$this->Shell->connection = '';
$this->Shell->params = array();
$this->Shell->args = array('User');
$this->Shell->all();
+
+ $this->assertEquals('User', $this->Shell->View->args[0]);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.