Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
disableExceptionOnInvalidPropertyPath example
$this
->
expectException
(
NoSuchPropertyException::
class
)
;
$obj
=
$this
->
generateAnonymousClass
(
'bar'
)
;
$this
->propertyAccessor->
getValue
(
$obj
, 'invalid_property'
)
;
}
public
function
testAnonymousClassReadReturnsNullOnInvalidPropertyWithDisabledException
(
)
{
$obj
=
$this
->
generateAnonymousClass
(
'bar'
)
;
$this
->propertyAccessor = PropertyAccess::
createPropertyAccessorBuilder
(
)
->
disableExceptionOnInvalidPropertyPath
(
)
->
getPropertyAccessor
(
)
;
$this
->
assertNull
(
$this
->propertyAccessor->
getValue
(
$obj
, 'invalid_property'
)
)
;
}
public
function
testAnonymousClassWrite
(
)
{
$value
= 'bar';
$obj
=
$this
->
generateAnonymousClass
(
''
)
;
$propertyAccessor
=
new
PropertyAccessor
(
PropertyAccessor::DISALLOW_MAGIC_METHODS, PropertyAccessor::THROW_ON_INVALID_PROPERTY_PATH,
new
ArrayAdapter
(
)
)
;