Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createXmlCLassMetadata example
public
function
testLoadClassMetadataReturnsThrowsInvalidMapping
(
)
{
$this
->
expectException
(
MappingException::
class
)
;
$loader
=
new
YamlFileLoader
(
__DIR__.'/../../Fixtures/invalid-mapping.yml'
)
;
$loader
->
loadClassMetadata
(
$this
->metadata
)
;
}
public
function
testLoadClassMetadata
(
)
{
$this
->loader->
loadClassMetadata
(
$this
->metadata
)
;
$this
->
assertEquals
(
TestClassMetadataFactory::
createXmlCLassMetadata
(
)
,
$this
->metadata
)
;
}
public
function
testMaxDepth
(
)
{
$classMetadata
=
new
ClassMetadata
(
MaxDepthDummy::
class
)
;
$this
->loader->
loadClassMetadata
(
$classMetadata
)
;
$attributesMetadata
=
$classMetadata
->
getAttributesMetadata
(
)
;
$this
->
assertEquals
(
2,
$attributesMetadata
[
'foo'
]
->
getMaxDepth
(
)
)
;
$this
->
assertEquals
(
3,
$attributesMetadata
[
'bar'
]
->
getMaxDepth
(
)
)
;
}
public
function
testLoadClassMetadataReturnsTrueIfSuccessful
(
)
{
$this
->
assertTrue
(
$this
->loader->
loadClassMetadata
(
$this
->metadata
)
)
;
}
public
function
testLoadClassMetadata
(
)
{
$this
->loader->
loadClassMetadata
(
$this
->metadata
)
;
$this
->
assertEquals
(
TestClassMetadataFactory::
createXmlCLassMetadata
(
)
,
$this
->metadata
)
;
}
public
function
testMaxDepth
(
)
{
$classMetadata
=
new
ClassMetadata
(
MaxDepthDummy::
class
)
;
$this
->loader->
loadClassMetadata
(
$classMetadata
)
;
$attributesMetadata
=
$classMetadata
->
getAttributesMetadata
(
)
;
$this
->
assertEquals
(
2,
$attributesMetadata
[
'foo'
]
->
getMaxDepth
(
)
)
;
$this
->
assertEquals
(
3,
$attributesMetadata
[
'bar'
]
->
getMaxDepth
(
)
)
;
}