diff --git a/tests/php/Forms/GroupedDropdownFieldTest.php b/tests/php/Forms/GroupedDropdownFieldTest.php
index 104f251c4..2adc2becd 100644
--- a/tests/php/Forms/GroupedDropdownFieldTest.php
+++ b/tests/php/Forms/GroupedDropdownFieldTest.php
@@ -14,16 +14,16 @@ class GroupedDropdownFieldTest extends SapphireTest
$field = GroupedDropdownField::create(
'Test',
'Testing',
- array(
- "1" => "One",
- "Group One" => array(
- "2" => "Two",
- "3" => "Three"
- ),
- "Group Two" => array(
- "4" => "Four"
- )
- )
+ [
+ "1" => "One",
+ "Group One" => [
+ "2" => "Two",
+ "3" => "Three"
+ ],
+ "Group Two" => [
+ "4" => "Four"
+ ],
+ ]
);
$this->assertEquals(array("1", "2", "3", "4"), $field->getValidValues());
@@ -59,4 +59,74 @@ class GroupedDropdownFieldTest extends SapphireTest
$this->assertFalse($field->validate($validator));
}
+
+ /**
+ * Test that empty-string values are supported by GroupDropdownTest
+ */
+ public function testEmptyString()
+ {
+ // Case A: empty value in the top level of the source
+ $field = GroupedDropdownField::create(
+ 'Test',
+ 'Testing',
+ [
+ "" => "(Choose A)",
+ "1" => "One",
+ "Group One" => [
+ "2" => "Two",
+ "3" => "Three"
+ ],
+ "Group Two" => [
+ "4" => "Four"
+ ],
+ ]
+ );
+
+ $this->assertRegExp(
+ '/