From 2350000be028fb8ffffc8f2166f8bc2c34e634ee Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 20 Oct 2008 03:01:01 +0000 Subject: [PATCH] Adding tests for formHelper::select() to test secured fields generation. Refs #5588 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7765 3807eeeb-6ff5-0310-8944-8be069107fe0 --- .../cases/libs/view/helpers/form.test.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index 7457f00ba..c36a01e78 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -688,6 +688,7 @@ class FormHelperTest extends CakeTestCase { ); $this->assertTags($result, $expected); } + /** * Tests correct generation of text fields for double and float fields * @@ -926,6 +927,7 @@ class FormHelperTest extends CakeTestCase { ); $this->assertTags($result, $expected); } + /** * testFormSecuredInput method * @@ -1039,6 +1041,25 @@ class FormHelperTest extends CakeTestCase { ); $this->assertEqual($this->Form->fields, $expected); } +/** + * test that multiple selects keys are added to field hash + * + * @access public + * @return void + */ + function testFormSecuredMultipleSelect() { + $this->Form->params['_Token']['key'] = 'testKey'; + $this->assertEqual($this->Form->fields, array()); + + $this->Form->select('Model.select', array('1' => 'one', '2' => 'two')); + $expected = array('Model.select'); + $this->assertEqual($this->Form->fields, $expected); + + $this->Form->fields = array(); + $this->Form->select('Model.select', array('1' => 'one', '2' => 'two'), null, array('multiple' => true)); + $expected = array('Model.select', 'Model.select' => ''); + $this->assertEqual($this->Form->fields, $expected); + } /** * testPasswordValidation method *