|
|
@@ -689,9 +689,10 @@ class FormHelperTest extends CakeTestCase {
|
|
|
public function testFormSecurityFields() {
|
|
|
$key = 'testKey';
|
|
|
$fields = array('Model.password', 'Model.username', 'Model.valid' => '0');
|
|
|
-
|
|
|
+ $secureAttributes = array('form' => 'MyTestForm');
|
|
|
+
|
|
|
$this->Form->request['_Token'] = array('key' => $key);
|
|
|
- $result = $this->Form->secure($fields);
|
|
|
+ $result = $this->Form->secure($fields, $secureAttributes);
|
|
|
|
|
|
$hash = Security::hash(serialize($fields) . Configure::read('Security.salt'));
|
|
|
$hash .= ':' . 'Model.valid';
|
|
|
@@ -701,11 +702,13 @@ class FormHelperTest extends CakeTestCase {
|
|
|
'div' => array('style' => 'display:none;'),
|
|
|
array('input' => array(
|
|
|
'type' => 'hidden', 'name' => 'data[_Token][fields]',
|
|
|
- 'value' => $hash, 'id' => 'preg:/TokenFields\d+/'
|
|
|
+ 'value' => $hash, 'id' => 'preg:/TokenFields\d+/',
|
|
|
+ 'form' => 'MyTestForm',
|
|
|
)),
|
|
|
array('input' => array(
|
|
|
'type' => 'hidden', 'name' => 'data[_Token][unlocked]',
|
|
|
- 'value' => '', 'id' => 'preg:/TokenUnlocked\d+/'
|
|
|
+ 'value' => '', 'id' => 'preg:/TokenUnlocked\d+/',
|
|
|
+ 'form' => 'MyTestForm',
|
|
|
)),
|
|
|
'/div'
|
|
|
);
|
|
|
@@ -713,16 +716,18 @@ class FormHelperTest extends CakeTestCase {
|
|
|
|
|
|
$path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS;
|
|
|
$this->Form->Html->loadConfig('htmlhelper_tags', $path);
|
|
|
- $result = $this->Form->secure($fields);
|
|
|
+ $result = $this->Form->secure($fields, $secureAttributes);
|
|
|
$expected = array(
|
|
|
'div' => array('class' => 'hidden'),
|
|
|
array('input' => array(
|
|
|
'type' => 'hidden', 'name' => 'data[_Token][fields]',
|
|
|
- 'value' => $hash, 'id' => 'preg:/TokenFields\d+/'
|
|
|
+ 'value' => $hash, 'id' => 'preg:/TokenFields\d+/',
|
|
|
+ 'form' => 'MyTestForm',
|
|
|
)),
|
|
|
array('input' => array(
|
|
|
'type' => 'hidden', 'name' => 'data[_Token][unlocked]',
|
|
|
- 'value' => '', 'id' => 'preg:/TokenUnlocked\d+/'
|
|
|
+ 'value' => '', 'id' => 'preg:/TokenUnlocked\d+/',
|
|
|
+ 'form' => 'MyTestForm',
|
|
|
)),
|
|
|
'/div'
|
|
|
);
|
|
|
@@ -9047,6 +9052,15 @@ class FormHelperTest extends CakeTestCase {
|
|
|
public function testFormEnd() {
|
|
|
$this->assertEquals('</form>', $this->Form->end());
|
|
|
|
|
|
+ $result = $this->Form->end('', array('form' => 'MyTestFormWithSupportForSecurityComponent'));
|
|
|
+ $expected = array(
|
|
|
+ 'div' => array('class' => 'submit'),
|
|
|
+ 'input' => array('type' => 'submit', 'value' => '', 'form' => 'MyTestFormWithSupportForSecurityComponent'),
|
|
|
+ '/div',
|
|
|
+ '/form'
|
|
|
+ );
|
|
|
+ $this->assertTags($result, $expected);
|
|
|
+
|
|
|
$result = $this->Form->end('');
|
|
|
$expected = array(
|
|
|
'div' => array('class' => 'submit'),
|