$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));
$extensions =
[ 'unmatched' =>
new \
ArrayIterator([new TestTypeExtension()]),
];