Skip to content

Commit

Permalink
move the test case to its own method
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Oct 23, 2012
1 parent 5064601 commit 044cf60
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions lib/Cake/Test/Case/View/Helper/FormHelperTest.php
Expand Up @@ -2614,6 +2614,36 @@ public function testInputOverridingMagicSelectType() {
$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.
*
Expand Down Expand Up @@ -2650,29 +2680,6 @@ public function testInputWithMatchingFieldAndModelName() {
'/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);
}

/**
Expand Down

0 comments on commit 044cf60

Please sign in to comment.