Skip to content

Commit

Permalink
Fixed secure field name for hidden().
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Feb 19, 2014
1 parent 78debec commit ebc629b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/View/Helper/FormHelper.php
Expand Up @@ -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';
Expand Down
8 changes: 5 additions & 3 deletions tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -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);
}

Expand All @@ -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'));
Expand All @@ -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));
Expand Down

0 comments on commit ebc629b

Please sign in to comment.