mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 15:39:53 +00:00
Added tests to prove wrong generation of hash when hidden value equal to 0 (zero). Refs #5061.
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7447 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
9e51a64f87
commit
cd09746201
1 changed files with 14 additions and 9 deletions
|
@ -778,10 +778,10 @@ class FormHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
function testFormSecuredInput() {
|
function testFormSecuredInput() {
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'UserForm' => array('0' => 'published', '1' => 'other', '2' => 'something'),
|
'UserForm' => array('0' => 'published', '1' => 'other', '2' => 'hidden', '3' => 'something'),
|
||||||
'_UserForm' => array('stuff' => '', 'something' => '0'),
|
'_UserForm' => array('stuff' => '', 'hidden' => '0', 'something' => '0'),
|
||||||
'__Token' => array('key' => 'testKey'
|
'__Token' => array('key' => 'testKey')
|
||||||
));
|
);
|
||||||
|
|
||||||
$fields = $this->__sortFields($fields);
|
$fields = $this->__sortFields($fields);
|
||||||
$fieldsKey = urlencode(Security::hash(serialize($fields) . Configure::read('Security.salt')));
|
$fieldsKey = urlencode(Security::hash(serialize($fields) . Configure::read('Security.salt')));
|
||||||
|
@ -827,6 +827,12 @@ class FormHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
$result = $this->Form->hidden('UserForm.hidden', array('value' => '0'));
|
||||||
|
$expected = array(
|
||||||
|
'input' => array('type' => 'hidden', 'name' => 'data[_UserForm][hidden]', 'value' => '0', 'id' => 'UserFormHidden')
|
||||||
|
);
|
||||||
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
$result = $this->Form->input('UserForm.something', array('type' => 'checkbox'));
|
$result = $this->Form->input('UserForm.something', array('type' => 'checkbox'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'div' => array('class' => 'input checkbox'),
|
'div' => array('class' => 'input checkbox'),
|
||||||
|
@ -1379,7 +1385,6 @@ class FormHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
$this->Form->validationErrors['Model']['field'] = 'minLength';
|
$this->Form->validationErrors['Model']['field'] = 'minLength';
|
||||||
$result = $this->Form->input('Model.field', array('error' => array('minLength' => __('Le login doit contenir au moins 2 caractères', true))));
|
$result = $this->Form->input('Model.field', array('error' => array('minLength' => __('Le login doit contenir au moins 2 caractères', true))));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
|
Loading…
Add table
Reference in a new issue