mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +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() {
|
||||
$fields = array(
|
||||
'UserForm' => array('0' => 'published', '1' => 'other', '2' => 'something'),
|
||||
'_UserForm' => array('stuff' => '', 'something' => '0'),
|
||||
'__Token' => array('key' => 'testKey'
|
||||
));
|
||||
'UserForm' => array('0' => 'published', '1' => 'other', '2' => 'hidden', '3' => 'something'),
|
||||
'_UserForm' => array('stuff' => '', 'hidden' => '0', 'something' => '0'),
|
||||
'__Token' => array('key' => 'testKey')
|
||||
);
|
||||
|
||||
$fields = $this->__sortFields($fields);
|
||||
$fieldsKey = urlencode(Security::hash(serialize($fields) . Configure::read('Security.salt')));
|
||||
|
@ -827,6 +827,12 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$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'));
|
||||
$expected = array(
|
||||
'div' => array('class' => 'input checkbox'),
|
||||
|
@ -1212,7 +1218,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
$result = explode(':', $result);
|
||||
$this->assertPattern('/option value="12"/', $result[0]);
|
||||
$this->assertNoPattern('/option value="13"/', $result[0]);
|
||||
|
||||
|
||||
//related to ticket #5013
|
||||
$result = $this->Form->input('Contact.date', array('type' => 'date', 'class' => 'customClass', 'onChange' => 'function(){}'));
|
||||
$this->assertPattern('/class="customClass"/', $result);
|
||||
|
@ -1222,7 +1228,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertPattern('/id="customIdDay"/', $result);
|
||||
$this->assertPattern('/id="customIdMonth"/', $result);
|
||||
$this->assertPattern('/onChange="function\(\)\{\}"/', $result);
|
||||
|
||||
|
||||
$result = $this->Form->input('Model.field', array('type' => 'datetime', 'timeFormat' => 24, 'id' => 'customID'));
|
||||
$this->assertPattern('/id="customIDDay"/', $result);
|
||||
$this->assertPattern('/id="customIDHour"/', $result);
|
||||
|
@ -1378,8 +1384,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
|
||||
|
||||
$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))));
|
||||
$expected = array(
|
||||
|
@ -1393,7 +1398,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
'/div',
|
||||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
/**
|
||||
* testFormInputs method
|
||||
|
|
Loading…
Add table
Reference in a new issue