Skip to content
Browse files

Fixed secure field name for hidden().

  • Loading branch information...
1 parent 78debec commit ebc629b63e2c6fa44cc3f244d08b9101ac4908bd @ADmad ADmad committed
Showing with 6 additions and 4 deletions.
  1. +1 −1 src/View/Helper/FormHelper.php
  2. +5 −3 tests/TestCase/View/Helper/FormHelperTest.php
View
2 src/View/Helper/FormHelper.php
@@ -1503,7 +1503,7 @@ public function hidden($fieldName, $options = array()) {
));
if ($secure === true) {
- $this->_secure(true, $options['name'], '' . $options['val']);
+ $this->_secure(true, $this->_secureFieldName($options), $options['val']);
}
$options['type'] = 'hidden';
View
8 tests/TestCase/View/Helper/FormHelperTest.php
@@ -1906,11 +1906,13 @@ public function testFormSecuredMultipleSelect() {
* @return void
*/
public function testFormSecuredRadio() {
+ $this->Form->request->params['_Token'] = 'testKey';
+
$this->assertEquals(array(), $this->Form->fields);
$options = array('1' => 'option1', '2' => 'option2');
$this->Form->radio('Test.test', $options);
- $expected = array('Test[test]' => '');
+ $expected = array('Test.test');
$this->assertEquals($expected, $this->Form->fields);
}
@@ -1920,7 +1922,7 @@ public function testFormSecuredRadio() {
* @return void
*/
public function testFormSecuredAndDisabledNotAssoc() {
- $this->Form->request->params['_csrfToken'] = 'testKey';
+ $this->Form->request->params['_Token'] = 'testKey';
$this->Form->select('Model.select', array(1, 2), array('disabled'));
$this->Form->checkbox('Model.checkbox', array('disabled'));
@@ -1942,7 +1944,7 @@ public function testFormSecuredAndDisabledNotAssoc() {
* @return void
*/
public function testFormSecuredAndDisabled() {
- $this->Form->request->params['_csrfToken'] = 'testKey';
+ $this->Form->request->params['_Token'] = 'testKey';
$this->Form->checkbox('Model.checkbox', array('disabled' => true));
$this->Form->text('Model.text', array('disabled' => true));

0 comments on commit ebc629b

Please sign in to comment.
Something went wrong with that request. Please try again.