$this->form->
submit([ 'foo' => 'Foo',
'bar' =>
new UploadedFile(__FILE__, 'upload.png', 'image/png', \UPLOAD_ERR_OK
),
]);
$this->
assertSame('Submitted data was expected to be text or number, file upload given.',
$this->form->
get('bar'
)->
getTransformationFailure()->
getMessage());
$this->
assertNull($this->form->
get('bar'
)->
getData());
} public function testMapDateTimeObjectsWithEmptyArrayDataUsingDataMapper() { $propertyAccessor = PropertyAccess::
createPropertyAccessorBuilder() ->
enableExceptionOnInvalidIndex() ->
getPropertyAccessor();
$form =
$this->factory->
createBuilder() ->
setDataMapper(new DataMapper(new PropertyPathAccessor($propertyAccessor))) ->
add('date', DateType::
class,
[ 'auto_initialize' => false,
'format' => 'dd/MM/yyyy',
'html5' => false,
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'widget' => 'single_text',
])