mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Adding test to show that select() doesn't always auto select options named 'Array'. Disproves #412
This commit is contained in:
parent
677ff2d8b7
commit
e304c48ec4
1 changed files with 30 additions and 0 deletions
|
@ -3237,6 +3237,36 @@ class FormHelperTest extends CakeTestCase {
|
|||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$this->Form->data = array('Model' => array('tags' => array(1)));
|
||||
$result = $this->Form->select(
|
||||
'Model.tags', array('1' => 'first', 'Array' => 'Array'), null, array('multiple' => 'checkbox')
|
||||
);
|
||||
$expected = array(
|
||||
'input' => array(
|
||||
'type' => 'hidden', 'name' => 'data[Model][tags]', 'value' => '', 'id' => 'ModelTags'
|
||||
),
|
||||
array('div' => array('class' => 'checkbox')),
|
||||
array('input' => array(
|
||||
'type' => 'checkbox', 'name' => 'data[Model][tags][]',
|
||||
'value' => '1', 'id' => 'ModelTags1', 'checked' => 'checked'
|
||||
)),
|
||||
array('label' => array('for' => 'ModelTags1', 'class' => 'selected')),
|
||||
'first',
|
||||
'/label',
|
||||
'/div',
|
||||
|
||||
array('div' => array('class' => 'checkbox')),
|
||||
array('input' => array(
|
||||
'type' => 'checkbox', 'name' => 'data[Model][tags][]',
|
||||
'value' => 'Array', 'id' => 'ModelTagsArray'
|
||||
)),
|
||||
array('label' => array('for' => 'ModelTagsArray')),
|
||||
'Array',
|
||||
'/label',
|
||||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue