Skip to content
Permalink
Browse files

Add tests for changes in #8387

Add tests covering the new behavior.
  • Loading branch information...
markstory committed Apr 2, 2016
1 parent 95558d0 commit c551faad4685b46057e6cfa7e762ca1013dd96b7
Showing with 28 additions and 0 deletions.
  1. +28 −0 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -8073,6 +8073,34 @@ public function testPostLinkSecurityHash() {
));
}
/**
* 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.
*

0 comments on commit c551faa

Please sign in to comment.
You can’t perform that action at this time.