Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
TypehintedPropertiesCar example
$this
->mapper->
mapDataToForms
(
$car
,
new
\
ArrayIterator
(
[
$form
]
)
)
;
self::
assertNull
(
$form
->
getData
(
)
)
;
}
public
function
testMapDataToFormsIgnoresUninitializedProperties
(
)
{
$engineForm
=
new
Form
(
new
FormConfigBuilder
(
'engine', null,
$this
->dispatcher
)
)
;
$colorForm
=
new
Form
(
new
FormConfigBuilder
(
'color', null,
$this
->dispatcher
)
)
;
$car
=
new
TypehintedPropertiesCar
(
)
;
$car
->engine = 'BMW';
$this
->mapper->
mapDataToForms
(
$car
,
new
\
ArrayIterator
(
[
$engineForm
,
$colorForm
]
)
)
;
self::
assertSame
(
$car
->engine,
$engineForm
->
getData
(
)
)
;
self::
assertNull
(
$colorForm
->
getData
(
)
)
;
}
public
function
testMapDataToFormsSetsDefaultDataIfPassedDataIsNull
(
)
{
$default
=
new
\
stdClass
(
)
;