Skip to content

Commit

Permalink
Forward port tests from 0776b87 to 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Feb 25, 2014
1 parent 7765c5a commit 7a9c9e3
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/TestCase/View/Helper/FormHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit 7a9c9e3

Please sign in to comment.