Skip to content

Commit

Permalink
Fixing failing tests in ViewTask test case, caused by changes in core…
Browse files Browse the repository at this point in the history
… templates.

Fixing incorrect variable usage where models would be double singularized causing incorrect names.  Fixes #668
  • Loading branch information
markstory committed May 7, 2010
1 parent fd7c1d4 commit 45d052b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cake/console/libs/tasks/view.php
Expand Up @@ -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);
Expand Down
29 changes: 15 additions & 14 deletions cake/tests/cases/console/libs/tasks/view.test.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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.