Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
FooTypeBarExtension example
public
function
testFailIfUnregisteredTypeNoFormType
(
)
{
$this
->
expectException
(
InvalidArgumentException::
class
)
;
$this
->registry->
getType
(
'stdClass'
)
;
}
public
function
testGetTypeWithTypeExtensions
(
)
{
$type
=
new
FooType
(
)
;
$ext1
=
new
FooTypeBarExtension
(
)
;
$ext2
=
new
FooTypeBazExtension
(
)
;
$this
->extension2->
addType
(
$type
)
;
$this
->extension1->
addTypeExtension
(
$ext1
)
;
$this
->extension2->
addTypeExtension
(
$ext2
)
;
$resolvedFormType
=
$this
->registry->
getType
(
FooType::
class
)
;
$this
->
assertInstanceOf
(
ResolvedFormType::
class
,
$resolvedFormType
)
;
$this
->
assertSame
(
$type
,
$resolvedFormType
->
getInnerType
(
)
)
;
$this
->
assertSame
(
[
$ext1
,
$ext2
]
,
$resolvedFormType
->
getTypeExtensions
(
)
)
;
}