Fixes issue with collections vs arrays
This commit is contained in:
1 parent
2806986b41
commit
023efce5fd
2 files changed
+14
-1
No files matched your search
+1
-1
@@ -540,7 +540,7 @@ class FormBuilder
|
|||||||
*/
|
*/
|
||||||
public function select(
|
public function select(
|
||||||
$name,
|
$name,
|
||||||
array $list = [],
|
$list = [],
|
||||||
$selected = null,
|
$selected = null,
|
||||||
array $selectAttributes = [],
|
array $selectAttributes = [],
|
||||||
array $optionsAttributes = []
|
array $optionsAttributes = []
|
||||||
|
|||||||
@@ -329,6 +329,19 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase
|
|||||||
'<select name="size"><option value="L" data-foo="bar" disabled="disabled">Large</option><option value="S">Small</option></select>');
|
'<select name="size"><option value="L" data-foo="bar" disabled="disabled">Large</option><option value="S">Small</option></select>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSelectCollection()
|
||||||
|
{
|
||||||
|
$select = $this->formBuilder->select(
|
||||||
|
'size',
|
||||||
|
collect(['L' => 'Large', 'S' => 'Small']),
|
||||||
|
null,
|
||||||
|
[],
|
||||||
|
['L' => ['data-foo' => 'bar', 'disabled']]
|
||||||
|
);
|
||||||
|
$this->assertEquals($select,
|
||||||
|
'<select name="size"><option value="L" data-foo="bar" disabled="disabled">Large</option><option value="S">Small</option></select>');
|
||||||
|
}
|
||||||
|
|
||||||
public function testFormSelectRepopulation()
|
public function testFormSelectRepopulation()
|
||||||
{
|
{
|
||||||
$list = ['L' => 'Large', 'M' => 'Medium', 'S' => 'Small'];
|
$list = ['L' => 'Large', 'M' => 'Medium', 'S' => 'Small'];
|
||||||
|
|||||||
Reference in new issue
Block a user