Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updating view and controller tasks to use (_singluar|_plural)HumanNam…

…e functions

Modifying the test case to expect humanized forms
  • Loading branch information...
commit 7c4dfed2999fb2d39c2843a6576c1822e1426900 1 parent ce8dd03
@AD7six AD7six authored
View
6 cake/console/libs/tasks/controller.php
@@ -92,7 +92,7 @@ function execute() {
$actions= $this->bakeActions($controller, $admin);
}
}
-
+
if (!empty($this->args[2]) && $this->args[2] == 'admin') {
$admin = $this->Project->getAdmin();
if ($admin) {
@@ -294,8 +294,8 @@ function bakeActions($controllerName, $admin = null, $wannaUseSession = true) {
$controllerPath = $this->_controllerPath($controllerName);
$pluralName = $this->_pluralName($currentModelName);
$singularName = Inflector::variable($currentModelName);
- $singularHumanName = Inflector::humanize($currentModelName);
- $pluralHumanName = Inflector::humanize($controllerName);
+ $singularHumanName = $this->_singularHumanName($currentModelName);
+ $pluralHumanName = $this->_pluralName($controllerName);
$this->Template->set(compact('admin', 'controllerPath', 'pluralName', 'singularName', 'singularHumanName',
'pluralHumanName', 'modelObj', 'wannaUseSession', 'currentModelName'));
View
10 cake/console/libs/tasks/view.php
@@ -284,9 +284,7 @@ function __loadController() {
$primaryKey = $modelObj->primaryKey;
$displayField = $modelObj->displayField;
$singularVar = Inflector::variable($modelClass);
- $pluralVar = Inflector::variable($this->controllerName);
- $singularHumanName = Inflector::humanize($modelClass);
- $pluralHumanName = Inflector::humanize($this->controllerName);
+ $singularHumanName = $this->_singularHumanName($modelClass);
$schema = $modelObj->schema();
$fields = array_keys($schema);
$associations = $this->__associations($modelObj);
@@ -294,13 +292,13 @@ function __loadController() {
$primaryKey = null;
$displayField = null;
$singularVar = Inflector::variable(Inflector::singularize($this->controllerName));
- $pluralVar = Inflector::variable($this->controllerName);
- $singularHumanName = Inflector::humanize(Inflector::singularize($this->controllerName));
- $pluralHumanName = Inflector::humanize($this->controllerName);
+ $singularHumanName = $this->_singularHumanName($this->controllerName);
$fields = array();
$schema = array();
$associations = array();
}
+ $pluralVar = Inflector::variable($this->controllerName);
+ $pluralHumanName = $this->_pluralHumanName($this->controllerName);
return compact('modelClass', 'schema', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
'singularHumanName', 'pluralHumanName', 'fields','associations');
View
12 cake/tests/cases/console/libs/tasks/view.test.php
@@ -260,11 +260,11 @@ function testBakeActions() {
$this->Task->expectAt(0, 'createFile', array(
TMP . 'view_task_comments' . DS . 'view.ctp',
- new PatternExpectation('/ViewTaskComments/')
+ new PatternExpectation('/View Task Comments/')
));
$this->Task->expectAt(1, 'createFile', array(
TMP . 'view_task_comments' . DS . 'edit.ctp',
- new PatternExpectation('/Edit ViewTaskComment/')
+ new PatternExpectation('/Edit View Task Comment/')
));
$this->Task->expectAt(2, 'createFile', array(
TMP . 'view_task_comments' . DS . 'index.ctp',
@@ -389,11 +389,11 @@ function testExecuteInteractive() {
));
$this->Task->expectAt(2, 'createFile', array(
TMP . 'view_task_comments' . DS . 'add.ctp',
- new PatternExpectation('/Add ViewTaskComment/')
+ new PatternExpectation('/Add View Task Comment/')
));
$this->Task->expectAt(3, 'createFile', array(
TMP . 'view_task_comments' . DS . 'edit.ctp',
- new PatternExpectation('/Edit ViewTaskComment/')
+ new PatternExpectation('/Edit View Task Comment/')
));
$this->Task->execute();
@@ -426,11 +426,11 @@ function testExecuteInteractiveWithAdmin() {
));
$this->Task->expectAt(2, 'createFile', array(
TMP . 'view_task_comments' . DS . 'admin_add.ctp',
- new PatternExpectation('/Add ViewTaskComment/')
+ new PatternExpectation('/Add View Task Comment/')
));
$this->Task->expectAt(3, 'createFile', array(
TMP . 'view_task_comments' . DS . 'admin_edit.ctp',
- new PatternExpectation('/Edit ViewTaskComment/')
+ new PatternExpectation('/Edit View Task Comment/')
));
$this->Task->execute();
Please sign in to comment.
Something went wrong with that request. Please try again.