$typeExtension2 =
new TestTypeExtension();
$typeExtension3 =
new OtherTypeExtension();
$typeExtension4 =
new MultipleTypesTypeExtension();
$extensions =
[ 'test' =>
new \
ArrayIterator([$typeExtension1,
$typeExtension2,
$typeExtension4]),
'other' =>
new \
ArrayIterator([$typeExtension3,
$typeExtension4]),
];
$extension =
new DependencyInjectionExtension(new ContainerBuilder(),
$extensions,
[]);
$this->
assertTrue($extension->
hasTypeExtensions('test'
));
$this->
assertTrue($extension->
hasTypeExtensions('other'
));
$this->
assertFalse($extension->
hasTypeExtensions('unknown'
));
$this->
assertSame([$typeExtension1,
$typeExtension2,
$typeExtension4],
$extension->
getTypeExtensions('test'
));
$this->
assertSame([$typeExtension3,
$typeExtension4],
$extension->
getTypeExtensions('other'
));
} public function testThrowExceptionForInvalidExtendedType() { $this->
expectException(InvalidArgumentException::
class);
$this->
expectExceptionMessage(sprintf('The extended type "unmatched" specified for the type extension class "%s" does not match any of the actual extended types (["test"]).', TestTypeExtension::
class));