Browse files

Fixing failing tests in ViewTask test case, caused by changes in core…

… templates.

Fixing incorrect variable usage where models would be double singularized causing incorrect names.  Fixes #668
  • Loading branch information...
1 parent fd7c1d4 commit 45d052b55aa0974e24782c52c41d312f7a390ec4 @markstory markstory committed May 6, 2010
Showing with 16 additions and 15 deletions.
  1. +1 −1 cake/console/libs/tasks/view.php
  2. +15 −14 cake/tests/cases/console/libs/tasks/view.test.php
View
2 cake/console/libs/tasks/view.php
@@ -294,7 +294,7 @@ function __loadController() {
$primaryKey = $modelObj->primaryKey;
$displayField = $modelObj->displayField;
$singularVar = Inflector::variable($modelClass);
- $singularHumanName = $this->_singularHumanName($modelClass);
+ $singularHumanName = $this->_singularHumanName($this->controllerName);
$schema = $modelObj->schema(true);
$fields = array_keys($schema);
$associations = $this->__associations($modelObj);
View
29 cake/tests/cases/console/libs/tasks/view.test.php
@@ -298,10 +298,10 @@ function testGetContent() {
);
$result = $this->Task->getContent('view', $vars);
- $this->assertPattern('/Delete .+Test View Model/', $result);
- $this->assertPattern('/Edit .+Test View Model/', $result);
- $this->assertPattern('/List .+Test View Models/', $result);
- $this->assertPattern('/New .+Test View Model/', $result);
+ $this->assertPattern('/Delete Test View Model/', $result);
+ $this->assertPattern('/Edit Test View Model/', $result);
+ $this->assertPattern('/List Test View Models/', $result);
+ $this->assertPattern('/New Test View Model/', $result);
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result);
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result);
@@ -331,10 +331,10 @@ function testGetContentWithAdminAction() {
);
$result = $this->Task->getContent('admin_view', $vars);
- $this->assertPattern('/Delete .+Test View Model/', $result);
- $this->assertPattern('/Edit .+Test View Model/', $result);
- $this->assertPattern('/List .+Test View Models/', $result);
- $this->assertPattern('/New .+Test View Model/', $result);
+ $this->assertPattern('/Delete Test View Model/', $result);
+ $this->assertPattern('/Edit Test View Model/', $result);
+ $this->assertPattern('/List Test View Models/', $result);
+ $this->assertPattern('/New Test View Model/', $result);
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result);
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result);
@@ -343,7 +343,7 @@ function testGetContentWithAdminAction() {
$result = $this->Task->getContent('admin_add', $vars);
$this->assertPattern("/input\('name'\)/", $result);
$this->assertPattern("/input\('body'\)/", $result);
- $this->assertPattern('/List .+Test View Models/', $result);
+ $this->assertPattern('/List Test View Models/', $result);
Configure::write('Routing', $_back);
}
@@ -406,7 +406,7 @@ function testBakeActions() {
));
$this->Task->expectAt(1, 'createFile', array(
TMP . 'view_task_comments' . DS . 'edit.ctp',
- new PatternExpectation('/Edit .+View Task Comment/')
+ new PatternExpectation('/Edit View Task Comment/')
));
$this->Task->expectAt(2, 'createFile', array(
TMP . 'view_task_comments' . DS . 'index.ctp',
@@ -576,11 +576,11 @@ function testExecuteInteractive() {
));
$this->Task->expectAt(2, 'createFile', array(
TMP . 'view_task_comments' . DS . 'add.ctp',
- new PatternExpectation('/Add .+View Task Comment/')
+ new PatternExpectation('/Add View Task Comment/')
));
$this->Task->expectAt(3, 'createFile', array(
TMP . 'view_task_comments' . DS . 'edit.ctp',
- new PatternExpectation('/Edit .+View Task Comment/')
+ new PatternExpectation('/Edit View Task Comment/')
));
$this->Task->execute();
@@ -633,11 +633,11 @@ function testExecuteInteractiveWithAdmin() {
));
$this->Task->expectAt(2, 'createFile', array(
TMP . 'view_task_comments' . DS . 'admin_add.ctp',
- new PatternExpectation('/Add .+View Task Comment/')
+ new PatternExpectation('/Add View Task Comment/')
));
$this->Task->expectAt(3, 'createFile', array(
TMP . 'view_task_comments' . DS . 'admin_edit.ctp',
- new PatternExpectation('/Edit .+View Task Comment/')
+ new PatternExpectation('/Edit View Task Comment/')
));
$this->Task->execute();
@@ -660,5 +660,6 @@ function testGetTemplate() {
$result = $this->Task->getTemplate('admin_add');
$this->assertEqual($result, 'form');
}
+
}
?>

0 comments on commit 45d052b

Please sign in to comment.