Adding tests for incorrect function used in form.ctp.

Fixing mistyped function name. Fixes #364
This commit is contained in:
mark_story 2009-11-26 09:52:15 -05:00
parent 3ad0595b86
commit 3907893263
2 changed files with 6 additions and 1 deletions

View file

@ -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";

View file

@ -336,6 +336,11 @@ class ViewTaskTest extends CakeTestCase {
$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);
}