/** * Se carga la configuración definida en los ficheros Resources/config/excepciones.[yml, xml] como configuraciones * globales del sistema, accesibles desde el contenedor de servicios. * * @param ContainerBuilder $container * @param string $direccion Dirección hasta la Carpeta DependencyInjection * * @throws \InvalidArgumentException Cuando no existe ningun fichero mombrado excepciones.[yml, xml]. */ public function loadFileExcepciones(ContainerBuilder $container, $dirección) { if ($this->direccionBundle == "" || $this->nameBundle == "") { $this->getDirBundle($container, $dirección); } $locator = new FileLocator($this->direccionBundle . '/Resources/config'); try { $loader = new YamlFileLoader($container, $locator); $locator->locate("excepciones.yml"); $configs = $loader->load('excepciones.yml'); } catch (\InvalidArgumentException $exc) { try { $loader = new XmlFileLoader($container, $locator); $locator->locate("excepciones.xml"); $configs["excepciones"] = $loader->load('excepciones.xml'); } catch (\InvalidArgumentException $exc) { throw $exc; } } $configuration = new ExcepcionesConfiguration(); $config = $this->processConfiguration($configuration, array('excepciones' => $configs)); $container->setParameter("excp_" . $container::underscore($this->nameBundle), $config); }
public function testSupports() { $loader = new XmlFileLoader(new ContainerBuilder(), new FileLocator()); $this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable'); $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); }