Skip to content
Permalink
Browse files

Forward port tests from 0776b87 to 3.x

  • Loading branch information...
markstory committed Feb 25, 2014
1 parent 7765c5a commit 7a9c9e33c8bd069e73349d3b8abc07bf0cc4578b
Showing with 38 additions and 0 deletions.
  1. +38 −0 tests/TestCase/View/Helper/FormHelperTest.php
@@ -6308,6 +6308,25 @@ public function testPostButton() {
$this->assertTrue(strpos($result, '<input type="hidden" name="extra" value="value"') !== false);
}
/**
* Test using postButton with N dimensional data.
*
* @return void
*/
public function testPostButtonNestedData() {
$data = array(
'one' => array(
'two' => array(
3, 4, 5
)
)
);
$result = $this->Form->postButton('Send', '/', array('data' => $data));
$this->assertContains('<input type="hidden" name="one[two][0]" value="3"', $result);
$this->assertContains('<input type="hidden" name="one[two][1]" value="4"', $result);
$this->assertContains('<input type="hidden" name="one[two][2]" value="5"', $result);
}
/**
* Test that postButton adds _Token fields.
*
@@ -6430,6 +6449,25 @@ public function testPostLink() {
));
}
/**
* Test using postLink with N dimensional data.
*
* @return void
*/
public function testPostLinkNestedData() {
$data = array(
'one' => array(
'two' => array(
3, 4, 5
)
)
);
$result = $this->Form->postLink('Send', '/', array('data' => $data));
$this->assertContains('<input type="hidden" name="one[two][0]" value="3"', $result);
$this->assertContains('<input type="hidden" name="one[two][1]" value="4"', $result);
$this->assertContains('<input type="hidden" name="one[two][2]" value="5"', $result);
}
/**
* test creating postLinks after a GET form.
*

0 comments on commit 7a9c9e3

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