Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
BaseUser example
->
enableAttributeMapping
(
)
->
addXmlMappings
(
[
__DIR__.'/../Resources/validator/BaseUser.xml'
]
)
->
addLoader
(
new
DoctrineLoader
(
DoctrineTestHelper::
createTestEntityManager
(
DoctrineTestHelper::
createTestConfigurationWithXmlLoader
(
)
)
, '{}'
)
)
->
getValidator
(
)
;
$classMetadata
=
$validator
->
getMetadataFor
(
new
BaseUser
(
1, 'DemoUser'
)
)
;
$constraints
=
$classMetadata
->
getConstraints
(
)
;
$this
->
assertCount
(
0,
$constraints
)
;
}
/** * @dataProvider regexpProvider */
public
function
testClassValidator
(
bool
$expected
, string
$classValidatorRegexp
= null
)
{
$doctrineLoader
=
new
DoctrineLoader
(
DoctrineTestHelper::
createTestEntityManager
(
)
,
$classValidatorRegexp
, false
)
;