8000 [Form] Limit allowed types for 'empty_value' TimeType option · symfony/symfony@7136987 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7136987

Browse files
committed
[Form] Limit allowed types for 'empty_value' TimeType option
1 parent b1068ad commit 7136987

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Symfony/Component/Form/Extension/Core/Type/TimeType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
237237
'hours' => 'array',
238238
'minutes' => 'array',
239239
'seconds' => 'array',
240+
'empty_value' => array('string', 'boolean', 'null'),
240241
));
241242
}
242243

src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,4 +730,14 @@ public function testThrowExceptionIfSecondsIsInvalid()
730730
'seconds' => 'bad value',
731731
));
732732
}
733+
734+
/**
735+
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
736+
*/
737+
public function testThrowExceptionIfEmptyValueIsInvalid()
738+
{
739+
$this->factory->create('time', null, array(
740+
'empty_value' => array(),
741+
));
742+
}
733743
}

0 commit comments

Comments
 (0)
0