Skip to content
Permalink
Browse files

Add test for #6237

Add test to for postLink() using the data that is supplied to it.

Refs #6237
  • Loading branch information...
markstory committed Apr 1, 2015
1 parent 6662fae commit 460476170cd9720f9ccc210edae55d636a7a0f9f
Showing with 21 additions and 3 deletions.
  1. +21 −3 tests/TestCase/View/Helper/FormHelperTest.php
@@ -6141,9 +6141,6 @@ public function testPostLink()
];
$this->assertHtml($expected, $result);
$result = $this->Form->postLink('Delete', '/posts/delete', ['data' => ['id' => 1]]);
$this->assertContains('<input type="hidden" name="id" value="1"', $result);
$result = $this->Form->postLink('Delete', '/posts/delete/1', ['target' => '_blank']);
$expected = [
'form' => [
@@ -6176,6 +6173,27 @@ public function testPostLink()
$this->assertHtml($expected, $result);
}
/**
* Test postLink with additional data.
*
* @return void
*/
public function testPostLinkWithData()
{
$result = $this->Form->postLink('Delete', '/posts/delete', ['data' => ['id' => 1]]);
$this->assertContains('<input type="hidden" name="id" value="1"', $result);
$entity = new Entity(['name' => 'no show'], ['source' => 'Articles']);
$this->Form->create($entity);
$this->Form->end();
$result = $this->Form->postLink('Delete', '/posts/delete', ['data' => ['name' => 'show']]);
$this->assertContains(
'<input type="hidden" name="name" value="show"',
$result,
'should not contain entity data.'
);
}
/**
* Test that security hashes for postLink include the url.
*

0 comments on commit 4604761

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