mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
95558d0bba
commit
c551faad46
1 changed files with 28 additions and 0 deletions
|
@ -8073,6 +8073,34 @@ class FormHelperTest extends CakeTestCase {
|
|||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that postLink doesn't modify the fields in the containing form.
|
||||
*
|
||||
* postLink() calls inside open forms should not modify the field list
|
||||
* for the form.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPostLinkSecurityHashInline() {
|
||||
$hash = Security::hash(
|
||||
'/posts/delete/1' .
|
||||
serialize(array()) .
|
||||
'' .
|
||||
Configure::read('Security.salt')
|
||||
);
|
||||
$hash .= '%3A';
|
||||
$this->Form->request->params['_Token']['key'] = 'test';
|
||||
|
||||
$this->Form->create('Post', ['url' => ['action' => 'add']]);
|
||||
$this->Form->input('title');
|
||||
$this->Form->postLink('Delete', '/posts/delete/1', ['inline' => false]);
|
||||
$result = $this->View->fetch('postLink');
|
||||
|
||||
$this->assertEquals(array('Post.title'), $this->Form->fields);
|
||||
$this->assertContains($hash, $result, 'Should contain the correct hash.');
|
||||
$this->assertAttributeEquals('/posts/add', '_lastAction', $this->Form, 'lastAction was should be restored.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test using postLink with N dimensional data.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue