'required' => false,
]) ->
add('firstName', TextTypeTest::TESTED_TYPE
) ->
add('lastName', TextTypeTest::TESTED_TYPE
) ->
getForm();
$this->
assertNull($form->
getData());
// partially empty, still an object is created
$form->
submit(['firstName' => 'Bernhard', 'lastName' => ''
]);
$author =
new Author();
$author->firstName = 'Bernhard';
$author->
setLastName(''
);
$this->
assertEquals($author,
$form->
getData());
} public function testSubmitWithDefaultDataDontCreateObject() { $defaultAuthor =
new Author();
$form =
$this->factory->
createBuilder(static::TESTED_TYPE, null,
[ // data class is inferred from the passed object