Skip to content

Commit

Permalink
Adding tests for incorrect function used in form.ctp.
Browse files Browse the repository at this point in the history
Fixing mistyped function name. Fixes #364
  • Loading branch information
markstory committed Nov 26, 2009
1 parent 3ad0595 commit 3907893
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cake/console/templates/default/views/form.ctp
Expand Up @@ -24,7 +24,7 @@
<?php
echo "\t<?php\n";
foreach ($fields as $field) {
if (substr($action, 'add') !== false && $field == $primaryKey) {
if (strpos($action, 'add') !== false && $field == $primaryKey) {
continue;
} elseif (!in_array($field, array('created', 'modified', 'updated'))) {
echo "\t\techo \$this->Form->input('{$field}');\n";
Expand Down
5 changes: 5 additions & 0 deletions cake/tests/cases/console/libs/tasks/view.test.php
Expand Up @@ -336,6 +336,11 @@ function testGetContentWithAdminAction() {
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result);
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'body\'\]/', $result);

$result = $this->Task->getContent('admin_add', $vars);
$this->assertPattern("/input\('name'\)/", $result);
$this->assertPattern("/input\('body'\)/", $result);
$this->assertPattern('/List .+Test View Models/', $result);

Configure::write('Routing', $_back);
}

Expand Down

0 comments on commit 3907893

Please sign in to comment.