Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getStringField example
$serializer
=
$this
->
getContainer
(
)
->
get
(
StringFieldSerializer::
class
)
;
$name
= 'string_' . Uuid::
randomHex
(
)
;
$data
=
new
KeyValuePair
(
$name
,
$input
, false
)
;
if
(
$type
=== 'writeException'
)
{
$this
->
expectException
(
WriteConstraintViolationException::
class
)
;
try
{
$serializer
->
encode
(
$this
->
getStringField
(
$name
,
$flags
)
,
EntityExistence::
createEmpty
(
)
,
$data
,
$this
->
getWriteParameterBagMock
(
)
)
->
current
(
)
;
}
catch
(
WriteConstraintViolationException
$e
)
{
static
::
assertSame
(
'/' .
$name
,
$e
->
getViolations
(
)
->
get
(
0
)
->
getPropertyPath
(
)
)
;
/* Unexpected language has to be fixed NEXT-9419 */
// static::assertSame($expected, $e->getViolations()->get(0)->getMessage());
throw
$e
;
}
}