Permalink
Browse files

Merge branch 'form-helper' into 2.0

  • Loading branch information...
2 parents 0366d8f + bef2e75 commit c2a96267b20a5425a21211031c4cc777f9ea8dcb @markstory markstory committed Jul 2, 2011
@@ -237,12 +237,6 @@ public function testExportVar() {
View::$cacheAction = false
View::$validationErrors = array
View::$hasRendered = false
- View::$modelScope = false
- View::$model = NULL
- View::$association = NULL
- View::$field = NULL
- View::$fieldSuffix = NULL
- View::$modelId = NULL
View::$uuids = array
View::$output = false
View::$request = NULL
@@ -775,23 +775,23 @@ public function testValidateHashNoModel() {
*/
public function testDuplicateFieldNameResolution() {
$result = $this->Form->create('ValidateUser');
- $this->assertEqual($this->View->entity(), array('ValidateUser'));
+ $this->assertEqual($this->Form->entity(), array('ValidateUser'));
$result = $this->Form->input('ValidateItem.name');
- $this->assertEqual($this->View->entity(), array('ValidateItem', 'name'));
+ $this->assertEqual($this->Form->entity(), array('ValidateItem', 'name'));
$result = $this->Form->input('ValidateUser.name');
- $this->assertEqual($this->View->entity(), array('ValidateUser', 'name'));
+ $this->assertEqual($this->Form->entity(), array('ValidateUser', 'name'));
$this->assertPattern('/name="data\[ValidateUser\]\[name\]"/', $result);
$this->assertPattern('/type="text"/', $result);
$result = $this->Form->input('ValidateItem.name');
- $this->assertEqual($this->View->entity(), array('ValidateItem', 'name'));
+ $this->assertEqual($this->Form->entity(), array('ValidateItem', 'name'));
$this->assertPattern('/name="data\[ValidateItem\]\[name\]"/', $result);
$this->assertPattern('/<textarea/', $result);
$result = $this->Form->input('name');
- $this->assertEqual($this->View->entity(), array('ValidateUser', 'name'));
+ $this->assertEqual($this->Form->entity(), array('ValidateUser', 'name'));
$this->assertPattern('/name="data\[ValidateUser\]\[name\]"/', $result);
$this->assertPattern('/type="text"/', $result);
}
@@ -1528,12 +1528,12 @@ public function testFormValidationMultiRecord() {
));
$result = $this->Form->input('Contact.2.name');
$expected = array(
- 'div' => array('class'),
- 'label' => array('for'),
- 'preg:/[^<]+/',
+ 'div' => array('class' => 'input text error'),
+ 'label' => array('for' => 'Contact2Name'),
+ 'Name',
'/label',
'input' => array(
- 'type' => 'text', 'name', 'id',
+ 'type' => 'text', 'name' => 'data[Contact][2][name]', 'id' => 'Contact2Name',
'class' => 'form-error', 'maxlength' => 255
),
array('div' => array('class' => 'error-message')),
@@ -4702,19 +4702,6 @@ public function testDateTime() {
);
$this->assertTags($result, $expected);
- $result = $this->Form->input('ContactTag');
- $expected = array(
- 'div' => array('class' => 'input select'),
- 'label' => array('for' => 'ContactTagContactTag'),
- 'Contact Tag',
- '/label',
- array('input' => array('type' => 'hidden', 'name' => 'data[ContactTag][ContactTag]', 'value' => '', 'id' => 'ContactTagContactTag_')),
- array('select' => array('name' => 'data[ContactTag][ContactTag][]', 'multiple' => 'multiple', 'id' => 'ContactTagContactTag')),
- '/select',
- '/div'
- );
- $this->assertTags($result, $expected);
-
$this->Form->create('Contact');
$result = $this->Form->input('published', array('monthNames' => false));
$now = strtotime('now');
@@ -1299,11 +1299,11 @@ public function testUseTag() {
$result = $this->Html->useTag('formend');
$this->assertTags($result, '/form');
- $result = $this->Html->useTag('form', ' test');
- $this->assertEqual($result, '<form test>');
+ $result = $this->Html->useTag('form', 'url', ' test');
+ $this->assertEqual($result, '<form action="url" test>');
- $result = $this->Html->useTag('form', array('test' => 'ok'));
- $this->assertTags($result, array('form' => array('test' => 'ok')));
+ $result = $this->Html->useTag('form', 'example.com', array('test' => 'ok'));
+ $this->assertTags($result, array('form' => array('test' => 'ok', 'action' => 'example.com')));
}
/**
Oops, something went wrong.

0 comments on commit c2a9626

Please sign in to comment.