$container =
new ContainerBuilder();
$loader =
new YamlFileLoader($container,
new FileLocator(self::
$fixturesPath.'/yaml'
));
$loader->
load('services_prototype.yml'
);
$ids =
array_keys(array_filter($container->
getDefinitions(),
fn ($def) => !
$def->
hasTag('container.excluded'
)));
sort($ids);
$this->
assertSame([Prototype\Foo::
class, Prototype\Sub\Bar::
class, 'service_container'
],
$ids);
$resources =
array_map('strval',
$container->
getResources());
$fixturesDir = \
dirname(__DIR__
).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
$this->
assertContains((string) new FileResource($fixturesDir.'yaml'.\DIRECTORY_SEPARATOR.'services_prototype.yml'
),
$resources);
$prototypeRealPath =
realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'Prototype'
);
$globResource =
new GlobResource( $fixturesDir.'Prototype',
'',
true,
false,
[ str_replace(\DIRECTORY_SEPARATOR, '/',
$prototypeRealPath.\DIRECTORY_SEPARATOR.'BadClasses'
) => true,
str_replace(\DIRECTORY_SEPARATOR, '/',
$prototypeRealPath.\DIRECTORY_SEPARATOR.'OtherDir'
) => true,
str_replace(\DIRECTORY_SEPARATOR, '/',
$prototypeRealPath.\DIRECTORY_SEPARATOR.'SinglyImplementedInterface'
) => true,
str_replace(\DIRECTORY_SEPARATOR, '/',
$prototypeRealPath.\DIRECTORY_SEPARATOR.'StaticConstructor'
) => true,
]