/** * Verifies that we can test for support. */ public function testSupports() { $collection = new ResourceCollection(); self::assertFalse($this->loader->supports('test.yml')); self::assertFalse($this->loader->supports($collection)); $collection->attach(new Resource('test.yml')); self::assertTrue($this->loader->supports($collection)); }
/** * Loads a configuration resource if available. * * @param ContainerBuilder $container The container. * @param string $dir The project directory path. */ private static function loadConfig(ContainerBuilder $container, $dir) { if (null !== $dir) { $locator = new FileLocator($dir); $loader = new ResourceCollectionLoader(new LoaderResolver(array(new XmlFileLoader($container, $locator), new YamlFileLoader($container, $locator)))); $resources = array(); foreach (self::$resources as $resource) { $resources[] = new ResourceSupport($resource[0], $resource[1]); } $loader->load(new ResourceCollection($resources)); $container->setParameter('box.project.dir', $dir); } else { $container->setParameter('box.project.dir', null); } }