def testLoad(self):
        """
        @covers Symfony\Component\Config\Loader\DelegatingLoader.load

        """

        loader = LoaderInterfaceMock1();
        resolver = LoaderResolver([loader]);
        loader = DelegatingLoader(resolver);

        loader.load('foo');
Пример #2
0
    def testLoad(self):
        """
        @covers Symfony\Component\Config\Loader\DelegatingLoader.load

        """

        loader = LoaderInterfaceMock1()
        resolver = LoaderResolver([loader])
        loader = DelegatingLoader(resolver)

        loader.load('foo')
    def testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded(self):
        """@expectedException Symfony\Component\Config\Exception\FileLoaderLoadException

        """

        try:
            loader = LoaderInterfaceMock2();
            resolver = LoaderResolver([loader]);
            loader = DelegatingLoader(resolver);

            loader.load('foo');

            self.fail()
        except Exception as e:
            self.assertTrue(isinstance(e, FileLoaderLoadException));
Пример #4
0
    def testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded(self):
        """@expectedException Symfony\Component\Config\Exception\FileLoaderLoadException

        """

        try:
            loader = LoaderInterfaceMock2()
            resolver = LoaderResolver([loader])
            loader = DelegatingLoader(resolver)

            loader.load('foo')

            self.fail()
        except Exception as e:
            self.assertTrue(isinstance(e, FileLoaderLoadException))
Пример #5
0
    def load(self, resource, resourceType=None):
        """Loads a resource.

        @param: mixed  resource A resource
        @param: string resourceType     The resource type

        @return: RouteCollection A RouteCollection instance

        """

        collection = BaseDelegatingLoader.load(self, resource, resourceType)

        for route in collection.all().values():
            controller = route.getDefault('_controller')
            if (controller):
                try:
                    controller = self._parser.parse(controller)
                except Exception:
                    # unable to optimize unknown notation
                    pass

                route.setDefault('_controller', controller)

        return collection