mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
b32deed4aa
commit
3433f4a1f0
2 changed files with 12 additions and 30 deletions
|
@ -713,25 +713,6 @@ class FormHelperTest extends CakeTestCase {
|
|||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS;
|
||||
$this->Form->Html->loadConfig('htmlhelper_tags', $path);
|
||||
$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+/',
|
||||
'form' => 'MyTestForm',
|
||||
)),
|
||||
array('input' => array(
|
||||
'type' => 'hidden', 'name' => 'data[_Token][unlocked]',
|
||||
'value' => '', 'id' => 'preg:/TokenUnlocked\d+/',
|
||||
'form' => 'MyTestForm',
|
||||
)),
|
||||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9052,10 +9033,10 @@ class FormHelperTest extends CakeTestCase {
|
|||
public function testFormEnd() {
|
||||
$this->assertEquals('</form>', $this->Form->end());
|
||||
|
||||
$result = $this->Form->end('', array('form' => 'MyTestFormWithSupportForSecurityComponent'));
|
||||
$result = $this->Form->end('', array('form' => 'form-name'));
|
||||
$expected = array(
|
||||
'div' => array('class' => 'submit'),
|
||||
'input' => array('type' => 'submit', 'value' => '', 'form' => 'MyTestFormWithSupportForSecurityComponent'),
|
||||
'input' => array('type' => 'submit', 'value' => ''),
|
||||
'/div',
|
||||
'/form'
|
||||
);
|
||||
|
|
|
@ -541,20 +541,21 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Generates a hidden field with a security hash based on the fields used in the form.
|
||||
* Generates a hidden field with a security hash based on the fields used in
|
||||
* the form.
|
||||
*
|
||||
* If $secureAttributes is set, these html attributes will be merged into the hidden input tags generated for the
|
||||
* Security Component. This is especially useful to set HTML5 attributes like 'form'.
|
||||
* If $secureAttributes is set, these html attributes will be merged into
|
||||
* the hidden input tags generated for the Security Component. This is
|
||||
* especially useful to set HTML5 attributes like 'form'.
|
||||
*
|
||||
* @param array|null $fields If set specifies the list of fields to use when generating the hash, else $this->fields
|
||||
* is being used.
|
||||
* @param array $secureAttributes will be passed as html attributes into the hidden input elements generated for the
|
||||
* Security Component.
|
||||
* @param array|null $fields If set specifies the list of fields to use when
|
||||
* generating the hash, else $this->fields is being used.
|
||||
* @param array $secureAttributes will be passed as html attributes into the hidden
|
||||
* input elements generated for the Security Component.
|
||||
* @return string A hidden input field with a security hash
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::secure
|
||||
*/
|
||||
public function secure($fields = array(), $secureAttributes = array()) {
|
||||
|
||||
if (!isset($this->request['_Token']) || empty($this->request['_Token'])) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue