Applying fix from ticket #2485, adding test for it

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4894 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
dho 2007-04-28 09:20:35 +00:00
parent da0dacb013
commit efd8df1771
2 changed files with 4 additions and 1 deletions

View file

@ -159,7 +159,7 @@ class FormHelper extends AppHelper {
'action' => $options['action'],
'id' => $id
);
if(!empty($options['action'])) {
if(!empty($options['action']) && !isset($options['id'])) {
$options['id'] = $model . Inflector::camelize($options['action']) . 'Form';
}
$options['action'] = am($actionDefaults, (array)$options['url']);

View file

@ -632,6 +632,9 @@ class FormHelperTest extends CakeTestCase {
$this->assertPattern('/^<form[^<>]+id="ContactEditForm"[^<>]+>/', $result);
$this->assertPattern('/^<form[^<>]+action="\/contacts\/edit\/1"[^<>]*>/', $result);
$this->assertNoPattern('/^<form[^<>]+[^id|method|action]=[^<>]*>/', $result);
$result = $this->Form->create('Contact', array('id' => 'TestId'));
$this->assertPattern('/id="TestId"/', $result);
}
function testFormEnd() {