Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
Money example
->
setData
(
'foo'
)
->
getForm
(
)
->
createView
(
)
;
$this
->
assertSame
(
'bar',
$view
->vars
[
'data'
]
)
;
$this
->
assertSame
(
'baz',
$view
->vars
[
'value'
]
)
;
}
public
function
testDataMapperTransformationFailedExceptionInvalidMessageIsUsed
(
)
{
$money
=
new
Money
(
20.5, 'EUR'
)
;
$factory
= Forms::
createFormFactoryBuilder
(
)
->
addExtensions
(
[
new
ValidatorExtension
(
Validation::
createValidator
(
)
)
]
)
->
getFormFactory
(
)
;
$builder
=
$factory
->
createBuilder
(
FormType::
class
,
$money
,
[
'invalid_message' => 'not the one to display'
]
)
->
add
(
'amount', TextType::
class
)
->
add
(
'currency', CurrencyType::
class
)
;
$builder
->
setDataMapper
(
new
MoneyDataMapper
(
)
)
;