Skip to content
Permalink
Browse files

Added test for FormHelper::radio().

Tests generating radio input for field with model other than one used
in create(). Refs #2911.
  • Loading branch information...
ADmad committed Feb 27, 2014
1 parent 0776b87 commit a707709e1de2b0834942a87e7cdd88c90adcdb43
Showing with 33 additions and 0 deletions.
  1. +33 −0 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -3730,6 +3730,39 @@ public function testRadio() {
$this->assertTags($result, $expected);
}
/**
* testRadioDifferentModel
* Refs #2911
*
* @return void
*/
public function testRadioDifferentModel() {
$this->Form->create('User');
$result = $this->Form->radio(
'Model.field',
array('v1' => 'option A', 'v2' => 'option B'),
array('label' => true, 'legend' => false, 'value' => false)
);
$expected = array(
array('input' => array(
'type' => 'radio', 'name' => 'data[Model][field]',
'value' => 'v1', 'id' => 'ModelFieldV1'
)),
array('label' => array('for' => 'ModelFieldV1')),
'option A',
'/label',
array('input' => array(
'type' => 'radio', 'name' => 'data[Model][field]',
'value' => 'v2', 'id' => 'ModelFieldV2'
)),
array('label' => array('for' => 'ModelFieldV2')),
'option B',
'/label'
);
$this->assertTags($result, $expected);
}
/**
* Test radio inputs with between as string or array. Also ensure
* that an array with less between elements works.

0 comments on commit a707709

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