From 023efce5fd8057cb3b5ce503f3391cc4effa7caa Mon Sep 17 00:00:00 2001 From: mlantz Date: Mon, 15 May 2017 05:38:20 -0400 Subject: [PATCH] Fixes issue with collections vs arrays --- src/FormBuilder.php | 2 +- tests/FormBuilderTest.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/FormBuilder.php b/src/FormBuilder.php index 60a2985..c225569 100644 --- a/src/FormBuilder.php +++ b/src/FormBuilder.php @@ -540,7 +540,7 @@ class FormBuilder */ public function select( $name, - array $list = [], + $list = [], $selected = null, array $selectAttributes = [], array $optionsAttributes = [] diff --git a/tests/FormBuilderTest.php b/tests/FormBuilderTest.php index f97b127..eeea737 100644 --- a/tests/FormBuilderTest.php +++ b/tests/FormBuilderTest.php @@ -329,6 +329,19 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase ''); } + public function testSelectCollection() + { + $select = $this->formBuilder->select( + 'size', + collect(['L' => 'Large', 'S' => 'Small']), + null, + [], + ['L' => ['data-foo' => 'bar', 'disabled']] + ); + $this->assertEquals($select, + ''); + } + public function testFormSelectRepopulation() { $list = ['L' => 'Large', 'M' => 'Medium', 'S' => 'Small'];