From 044cf60b69563ce60e73c60cac7f1361a5b346e4 Mon Sep 17 00:00:00 2001 From: euromark Date: Tue, 23 Oct 2012 16:07:43 +0200 Subject: [PATCH] move the test case to its own method --- .../Test/Case/View/Helper/FormHelperTest.php | 53 +++++++++++-------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 340247be0..60dfdde24 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -2614,6 +2614,36 @@ class FormHelperTest extends CakeTestCase { $this->assertTags($result, $expected); } +/** + * Test that magic input() selects are created for type=number + * + * @return void + */ + public function testInputMagicSelectForTypeNumber() { + $this->View->viewVars['balances'] = array(0 => 'nothing', 1 => 'some', 100 => 'a lot'); + $this->Form->request->data = array('ValidateUser' => array('balance' => 1)); + $result = $this->Form->input('ValidateUser.balance'); + $expected = array( + 'div' => array('class' => 'input select'), + 'label' => array('for' => 'ValidateUserBalance'), + 'Balance', + '/label', + 'select' => array('name' => 'data[ValidateUser][balance]', 'id' => 'ValidateUserBalance'), + array('option' => array('value' => '0')), + 'nothing', + '/option', + array('option' => array('value' => '1', 'selected' => 'selected')), + 'some', + '/option', + array('option' => array('value' => '100')), + 'a lot', + '/option', + '/select', + '/div' + ); + $this->assertTags($result, $expected); + } + /** * Test that magic input() selects can easily be converted into radio types without error. * @@ -2650,29 +2680,6 @@ class FormHelperTest extends CakeTestCase { '/div' ); $this->assertTags($result, $expected); - - $this->View->viewVars['balances'] = array(0 => 'nothing', 1 => 'some', 100 => 'a lot'); - $this->Form->request->data = array('ValidateUser' => array('balance' => 1)); - $result = $this->Form->input('ValidateUser.balance'); - $expected = array( - 'div' => array('class' => 'input select'), - 'label' => array('for' => 'ValidateUserBalance'), - 'Balance', - '/label', - 'select' => array('name' => 'data[ValidateUser][balance]', 'id' => 'ValidateUserBalance'), - array('option' => array('value' => '0')), - 'nothing', - '/option', - array('option' => array('value' => '1', 'selected' => 'selected')), - 'some', - '/option', - array('option' => array('value' => '100')), - 'a lot', - '/option', - '/select', - '/div' - ); - $this->assertTags($result, $expected); } /**