- */
-interface LoaderInterface
-{
- /**
- * Loads a resource.
- *
- * A resource can be anything that can be converted to a
- * ContainerBuilder instance.
- *
- * Some loaders support an array of resources as an argument to the
- * constructor.
- *
- * If multiple resources are loaded, the services and parameters are merged.
- *
- * Remember that services and parameters are simple key/pair stores.
- *
- * When overriding a value, the old one is totally replaced, even if it is
- * a "complex" value (an array for instance):
- *
- *
- * file1.xml
- *
- * true
- * false
- *
- *
- * file2.xml
- * foo
- *
- *
- * If you load file1.xml and file2.xml in this order, the value of complex
- * will be "foo".
- *
- * @param mixed $resource The resource
- */
- function load($resource);
-
- /**
- * Returns true if this class supports the given resource.
- *
- * @param mixed $resource A resource
- *
- * @return Boolean true if this class supports the given resource, false otherwise
- */
- function supports($resource);
-
- /**
- * Gets the loader resolver.
- *
- * @return LoaderResolver A LoaderResolver instance
- */
- function getResolver();
-
- /**
- * Sets the loader resolver.
- *
- * @param LoaderResolver $resolver A LoaderResolver instance
- */
- function setResolver(LoaderResolver $resolver);
-}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/FileLocator.php b/src/Symfony/Component/HttpKernel/Config/Loader/FileLocator.php
similarity index 90%
rename from src/Symfony/Bundle/FrameworkBundle/Routing/FileLocator.php
rename to src/Symfony/Component/HttpKernel/Config/Loader/FileLocator.php
index 9b620b9e1c..b37801c2c8 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Routing/FileLocator.php
+++ b/src/Symfony/Component/HttpKernel/Config/Loader/FileLocator.php
@@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Bundle\FrameworkBundle\Routing;
+namespace Symfony\Component\HttpKernel\Config\Loader;
-use Symfony\Component\Routing\Loader\FileLocator as BaseFileLocator;
+use Symfony\Component\Config\Loader\FileLocator as BaseFileLocator;
use Symfony\Component\HttpKernel\KernelInterface;
/**
diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/Loader/FileLocator.php b/src/Symfony/Component/HttpKernel/DependencyInjection/Loader/FileLocator.php
deleted file mode 100644
index d2a3616aac..0000000000
--- a/src/Symfony/Component/HttpKernel/DependencyInjection/Loader/FileLocator.php
+++ /dev/null
@@ -1,50 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\HttpKernel\DependencyInjection\Loader;
-
-use Symfony\Component\DependencyInjection\Loader\FileLocator as BaseFileLocator;
-use Symfony\Component\HttpKernel\KernelInterface;
-
-/**
- * FileLocator uses the KernelInterface to locate resources in bundles.
- *
- * @author Fabien Potencier
- */
-class FileLocator extends BaseFileLocator
-{
- protected $kernel;
-
- /**
- * Constructor.
- *
- * @param KernelInterface $kernel A KernelInterface instance
- * @param string|array $paths A path or an array of paths where to look for resources
- */
- public function __construct(KernelInterface $kernel, array $paths = array())
- {
- $this->kernel = $kernel;
-
- parent::__construct($paths);
- }
-
- /**
- * {@inheritdoc}
- */
- public function locate($file, $currentPath = null)
- {
- if ('@' === $file[0]) {
- return $this->kernel->locateResource($file);
- }
-
- return parent::locate($file, $currentPath);
- }
-}
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index a31cc064b9..fdd4cab772 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -15,9 +15,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
-use Symfony\Component\DependencyInjection\Loader\DelegatingLoader;
-use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
-use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
@@ -26,7 +23,9 @@ use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
-use Symfony\Component\HttpKernel\DependencyInjection\Loader\FileLocator;
+use Symfony\Component\HttpKernel\Config\Loader\FileLocator;
+use Symfony\Component\Config\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\DelegatingLoader;
/**
* The Kernel is the heart of the Symfony system.
diff --git a/src/Symfony/Component/HttpKernel/KernelInterface.php b/src/Symfony/Component/HttpKernel/KernelInterface.php
index 7ca1928dd4..59d8f78b23 100644
--- a/src/Symfony/Component/HttpKernel/KernelInterface.php
+++ b/src/Symfony/Component/HttpKernel/KernelInterface.php
@@ -12,9 +12,9 @@
namespace Symfony\Component\HttpKernel;
use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
+use Symfony\Component\Config\Loader\LoaderInterface;
/**
* The Kernel is the heart of the Symfony system.
diff --git a/src/Symfony/Component/HttpKernel/bootstrap.php b/src/Symfony/Component/HttpKernel/bootstrap.php
index 378fe0655f..1001f1ea76 100644
--- a/src/Symfony/Component/HttpKernel/bootstrap.php
+++ b/src/Symfony/Component/HttpKernel/bootstrap.php
@@ -438,9 +438,9 @@ class HttpKernel implements HttpKernelInterface
namespace Symfony\Component\HttpKernel
{
use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
+use Symfony\Component\Config\Loader\LoaderInterface;
interface KernelInterface extends HttpKernelInterface, \Serializable
{
function registerRootDir();
@@ -469,7 +469,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\DependencyInjection\Loader\DelegatingLoader;
-use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
diff --git a/src/Symfony/Component/HttpKernel/bootstrap_cache.php b/src/Symfony/Component/HttpKernel/bootstrap_cache.php
index c68c7fdfff..99b5ac55bd 100644
--- a/src/Symfony/Component/HttpKernel/bootstrap_cache.php
+++ b/src/Symfony/Component/HttpKernel/bootstrap_cache.php
@@ -2,9 +2,9 @@
namespace Symfony\Component\HttpKernel
{
use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
+use Symfony\Component\Config\Loader\LoaderInterface;
interface KernelInterface extends HttpKernelInterface, \Serializable
{
function registerRootDir();
@@ -33,7 +33,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\DependencyInjection\Loader\DelegatingLoader;
-use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
index 3ba559d41f..a79fd8c9e0 100644
--- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
+++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
@@ -13,10 +13,11 @@ namespace Symfony\Component\Routing\Loader;
use Doctrine\Common\Annotations\AnnotationReader;
use Symfony\Component\Routing\Annotation\Route as RouteAnnotation;
-use Symfony\Component\Routing\Loader\LoaderResolver;
use Symfony\Component\Routing\Resource\FileResource;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
+use Symfony\Component\Config\Loader\LoaderInterface;
+use Symfony\Component\Config\Loader\LoaderResolver;
/**
* AnnotationClassLoader loads routing information from a PHP class and its methods.
diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php
index e812459f59..e6ae2cb5bf 100644
--- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php
+++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php
@@ -13,6 +13,8 @@ namespace Symfony\Component\Routing\Loader;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Resource\FileResource;
+use Symfony\Component\Config\Loader\FileLoader;
+use Symfony\Component\Config\Loader\FileLocator;
/**
* AnnotationFileLoader loads routing information from annotations set
diff --git a/src/Symfony/Component/Routing/Loader/ClosureLoader.php b/src/Symfony/Component/Routing/Loader/ClosureLoader.php
index e86470b242..c00ace1a96 100644
--- a/src/Symfony/Component/Routing/Loader/ClosureLoader.php
+++ b/src/Symfony/Component/Routing/Loader/ClosureLoader.php
@@ -11,6 +11,8 @@
namespace Symfony\Component\Routing\Loader;
+use Symfony\Component\Config\Loader\Loader;
+
/**
* ClosureLoader loads routes from a PHP closure.
*
diff --git a/src/Symfony/Component/Routing/Loader/DelegatingLoader.php b/src/Symfony/Component/Routing/Loader/DelegatingLoader.php
deleted file mode 100644
index 998f570088..0000000000
--- a/src/Symfony/Component/Routing/Loader/DelegatingLoader.php
+++ /dev/null
@@ -1,80 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Loader;
-
-use Symfony\Component\Routing\RouteCollection;
-
-/**
- * DelegatingLoader delegates route loading to other loaders using a loader resolver.
- *
- * This loader acts as an array of LoaderInterface objects - each having
- * a chance to load a given resource (handled by the resolver)
- *
- * @author Fabien Potencier
- */
-class DelegatingLoader extends Loader
-{
- /**
- * @var LoaderResolverInterface
- */
- protected $resolver;
-
- /**
- * Constructor.
- *
- * @param LoaderResolverInterface $resolver A LoaderResolverInterface instance
- */
- public function __construct(LoaderResolverInterface $resolver)
- {
- $this->resolver = $resolver;
- }
-
- /**
- * Loads a resource.
- *
- * @param mixed $resource A resource
- * @param string $type The resource type
- *
- * @return RouteCollection A RouteCollection instance
- *
- * @throws \InvalidArgumentException When the resource cannot be loaded
- */
- public function load($resource, $type = null)
- {
- $loader = $this->resolver->resolve($resource, $type);
-
- if (false === $loader) {
- throw new \InvalidArgumentException(sprintf('Unable to load the "%s" routing resource.', is_string($resource) ? $resource : (is_object($resource) ? get_class($resource) : 'RESOURCE')));
- }
-
- return $loader->load($resource, $type);
- }
-
- /**
- * Returns true if this class supports the given resource.
- *
- * @param mixed $resource A resource
- * @param string $type The resource type
- *
- * @return Boolean True if this class supports the given resource, false otherwise
- */
- public function supports($resource, $type = null)
- {
- foreach ($this->resolver->getLoaders() as $loader) {
- if ($loader->supports($resource, $type)) {
- return true;
- }
- }
-
- return false;
- }
-}
diff --git a/src/Symfony/Component/Routing/Loader/Loader.php b/src/Symfony/Component/Routing/Loader/Loader.php
deleted file mode 100644
index a46116aa9f..0000000000
--- a/src/Symfony/Component/Routing/Loader/Loader.php
+++ /dev/null
@@ -1,79 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Loader;
-
-/**
- * Loader is the abstract class used by all built-in loaders.
- *
- * @author Fabien Potencier
- */
-abstract class Loader implements LoaderInterface
-{
- protected $resolver;
-
- /**
- * Gets the loader resolver.
- *
- * @return LoaderResolver A LoaderResolver instance
- */
- public function getResolver()
- {
- return $this->resolver;
- }
-
- /**
- * Sets the loader resolver.
- *
- * @param LoaderResolver $resolver A LoaderResolver instance
- */
- public function setResolver(LoaderResolver $resolver)
- {
- $this->resolver = $resolver;
- }
-
- /**
- * Adds routes from a resource.
- *
- * @param mixed $resource A Resource
- * @param string $type The resource type
- */
- public function import($resource, $type = null)
- {
- $this->resolve($resource, $type)->load($resource);
- }
-
- /**
- * Finds a loader able to load an imported resource
- *
- * @param mixed $resource A Resource
- * @param string $type The resource type
- *
- * @return LoaderInterface A LoaderInterface instance
- *
- * @throws \InvalidArgumentException if no loader is found
- */
- public function resolve($resource, $type = null)
- {
- $loader = false;
- if ($this->supports($resource, $type)) {
- $loader = $this;
- } elseif (null !== $this->resolver) {
- $loader = $this->resolver->resolve($resource, $type);
- }
-
- if (false === $loader) {
- throw new \InvalidArgumentException(sprintf('Unable to load the "%s" routing resource.', is_string($resource) ? $resource : (is_object($resource) ? get_class($resource) : 'RESOURCE')));
- }
-
- return $loader;
- }
-}
diff --git a/src/Symfony/Component/Routing/Loader/LoaderResolver.php b/src/Symfony/Component/Routing/Loader/LoaderResolver.php
deleted file mode 100644
index 1411e9882a..0000000000
--- a/src/Symfony/Component/Routing/Loader/LoaderResolver.php
+++ /dev/null
@@ -1,75 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Loader;
-
-/**
- * LoaderResolver selects a loader for a given resource.
- *
- * @author Fabien Potencier
- */
-class LoaderResolver implements LoaderResolverInterface
-{
- protected $loaders;
-
- /**
- * Constructor.
- *
- * @param array $loaders An array of LoaderInterface instances to add
- */
- public function __construct(array $loaders = array())
- {
- $this->loaders = array();
- foreach ($loaders as $loader) {
- $this->addLoader($loader);
- }
- }
-
- /**
- * Returns a loader able to load the resource.
- *
- * @param mixed $resource A resource
- * @param string $type The resource type
- *
- * @return LoaderInterface|false A LoaderInterface instance supporting the resource if one exists, false otherwise
- */
- public function resolve($resource, $type = null)
- {
- foreach ($this->loaders as $loader) {
- if ($loader->supports($resource, $type)) {
- return $loader;
- }
- }
-
- return false;
- }
-
- /**
- * Adds a loader.
- *
- * @param LoaderInterface $loader A LoaderInterface instance
- */
- public function addLoader(LoaderInterface $loader)
- {
- $this->loaders[] = $loader;
- $loader->setResolver($this);
- }
-
- /**
- * Returns the registered loaders.
- *
- * @return array An array of LoaderInterface instances
- */
- public function getLoaders()
- {
- return $this->loaders;
- }
-}
diff --git a/src/Symfony/Component/Routing/Loader/LoaderResolverInterface.php b/src/Symfony/Component/Routing/Loader/LoaderResolverInterface.php
deleted file mode 100644
index dea15ca47e..0000000000
--- a/src/Symfony/Component/Routing/Loader/LoaderResolverInterface.php
+++ /dev/null
@@ -1,30 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Loader;
-
-/**
- * LoaderResolverInterface selects a loader for a given resource.
- *
- * @author Fabien Potencier
- */
-interface LoaderResolverInterface
-{
- /**
- * Returns a loader able to load the resource.
- *
- * @param mixed $resource A resource
- * @param string $type The resource type
- *
- * @return LoaderInterface|false A LoaderInterface instance supporting the resource if one exists, false otherwise
- */
- function resolve($resource, $type = null);
-}
diff --git a/src/Symfony/Component/Routing/Loader/PhpFileLoader.php b/src/Symfony/Component/Routing/Loader/PhpFileLoader.php
index 3be9000d9c..80f9142f4c 100644
--- a/src/Symfony/Component/Routing/Loader/PhpFileLoader.php
+++ b/src/Symfony/Component/Routing/Loader/PhpFileLoader.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Routing\Loader;
use Symfony\Component\Routing\Resource\FileResource;
+use Symfony\Component\Config\Loader\FileLoader;
/**
* PhpFileLoader loads routes from a PHP file.
diff --git a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php
index 7370939446..44af6751ba 100644
--- a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php
+++ b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php
@@ -14,6 +14,7 @@ namespace Symfony\Component\Routing\Loader;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\Resource\FileResource;
+use Symfony\Component\Config\Loader\FileLoader;
/**
* XmlFileLoader loads XML routing files.
diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php
index 6898c7ae7c..f9659c4300 100644
--- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php
+++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php
@@ -15,6 +15,7 @@ use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\Resource\FileResource;
use Symfony\Component\Yaml\Yaml;
+use Symfony\Component\Config\Loader\FileLoader;
/**
* YamlFileLoader loads Yaml routing files.
diff --git a/tests/Symfony/Tests/Component/Config/Fixtures/foo.xml b/tests/Symfony/Tests/Component/Config/Fixtures/foo.xml
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/Symfony/Tests/Component/Config/Loader/DelegatingLoaderTest.php b/tests/Symfony/Tests/Component/Config/Loader/DelegatingLoaderTest.php
new file mode 100644
index 0000000000..f6679920d0
--- /dev/null
+++ b/tests/Symfony/Tests/Component/Config/Loader/DelegatingLoaderTest.php
@@ -0,0 +1,87 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Tests\Component\Config\Loader;
+
+use Symfony\Component\Config\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\DelegatingLoader;
+use Symfony\Component\Config\Loader\XmlFileLoader;
+use Symfony\Component\Config\Loader\ClosureLoader;
+use Symfony\Component\Config\RouteCollection;
+use Symfony\Component\Config\Route;
+
+class DelegatingLoaderTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * @covers Symfony\Component\Config\Loader\DelegatingLoader::__construct
+ */
+ public function testConstructor()
+ {
+ $loader = new DelegatingLoader($resolver = new LoaderResolver());
+ $this->assertTrue(true, '__construct() takes a loader resolver as its first argument');
+ }
+
+ /**
+ * @covers Symfony\Component\Config\Loader\DelegatingLoader::getResolver
+ * @covers Symfony\Component\Config\Loader\DelegatingLoader::setResolver
+ */
+ public function testGetSetResolver()
+ {
+ $resolver = new LoaderResolver();
+ $loader = new DelegatingLoader($resolver);
+ $this->assertSame($resolver, $loader->getResolver(), '->getResolver() gets the resolver loader');
+ $loader->setResolver($resolver = new LoaderResolver());
+ $this->assertSame($resolver, $loader->getResolver(), '->setResolver() sets the resolver loader');
+ }
+
+ /**
+ * @covers Symfony\Component\Config\Loader\DelegatingLoader::supports
+ */
+ public function testSupports()
+ {
+ $loader1 = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
+ $loader1->expects($this->once())->method('supports')->will($this->returnValue(true));
+ $loader = new DelegatingLoader(new LoaderResolver(array($loader1)));
+ $this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable');
+
+ $loader1 = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
+ $loader1->expects($this->once())->method('supports')->will($this->returnValue(false));
+ $loader = new DelegatingLoader(new LoaderResolver(array($loader1)));
+ $this->assertFalse($loader->supports('foo.foo'), '->supports() returns false if the resource is not loadable');
+ }
+
+ /**
+ * @covers Symfony\Component\Config\Loader\DelegatingLoader::load
+ */
+ public function testLoad()
+ {
+ $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
+ $loader->expects($this->once())->method('supports')->will($this->returnValue(true));
+ $loader->expects($this->once())->method('load');
+ $resolver = new LoaderResolver(array($loader));
+ $loader = new DelegatingLoader($resolver);
+
+ $loader->load('foo');
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded()
+ {
+ $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
+ $loader->expects($this->once())->method('supports')->will($this->returnValue(false));
+ $resolver = new LoaderResolver(array($loader));
+ $loader = new DelegatingLoader($resolver);
+
+ $loader->load('foo');
+ }
+}
diff --git a/tests/Symfony/Tests/Component/Routing/Loader/FileLocatorTest.php b/tests/Symfony/Tests/Component/Config/Loader/FileLocatorTest.php
similarity index 88%
rename from tests/Symfony/Tests/Component/Routing/Loader/FileLocatorTest.php
rename to tests/Symfony/Tests/Component/Config/Loader/FileLocatorTest.php
index 655aadcdd7..126b1d8809 100644
--- a/tests/Symfony/Tests/Component/Routing/Loader/FileLocatorTest.php
+++ b/tests/Symfony/Tests/Component/Config/Loader/FileLocatorTest.php
@@ -9,15 +9,15 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Tests\Component\Routing\Loader;
+namespace Symfony\Tests\Component\Config\Loader;
-use Symfony\Component\Routing\Loader\FileLocator;
+use Symfony\Component\Config\Loader\FileLocator;
class FileLocatorTest extends \PHPUnit_Framework_TestCase
{
/**
- * @covers Symfony\Component\Routing\Loader\FileLocator::GetAbsolutePath
- * @covers Symfony\Component\Routing\Loader\FileLocator::isAbsolutePath
+ * @covers Symfony\Component\Config\Loader\FileLocator::GetAbsolutePath
+ * @covers Symfony\Component\Config\Loader\FileLocator::isAbsolutePath
*/
public function testGetAbsolutePath()
{
diff --git a/tests/Symfony/Tests/Component/DependencyInjection/Loader/LoaderResolverTest.php b/tests/Symfony/Tests/Component/Config/Loader/LoaderResolverTest.php
similarity index 53%
rename from tests/Symfony/Tests/Component/DependencyInjection/Loader/LoaderResolverTest.php
rename to tests/Symfony/Tests/Component/Config/Loader/LoaderResolverTest.php
index 4953551e0c..a05a9e1f9e 100644
--- a/tests/Symfony/Tests/Component/DependencyInjection/Loader/LoaderResolverTest.php
+++ b/tests/Symfony/Tests/Component/Config/Loader/LoaderResolverTest.php
@@ -9,47 +9,47 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Tests\Component\DependencyInjection\Loader;
+namespace Symfony\Tests\Component\Config\Loader;
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
-use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
+use Symfony\Component\Config\Loader\LoaderResolver;
class LoaderResolverTest extends \PHPUnit_Framework_TestCase
{
/**
- * @covers Symfony\Component\DependencyInjection\Loader\LoaderResolver::__construct
+ * @covers Symfony\Component\Config\Loader\LoaderResolver::__construct
*/
public function testConstructor()
{
$resolver = new LoaderResolver(array(
- $loader = new ClosureLoader(new ContainerBuilder()),
+ $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'),
));
$this->assertEquals(array($loader), $resolver->getLoaders(), '__construct() takes an array of loaders as its first argument');
}
/**
- * @covers Symfony\Component\DependencyInjection\Loader\LoaderResolver::resolve
+ * @covers Symfony\Component\Config\Loader\LoaderResolver::resolve
*/
public function testResolve()
{
- $resolver = new LoaderResolver(array(
- $loader = new ClosureLoader(new ContainerBuilder()),
- ));
-
+ $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
+ $resolver = new LoaderResolver(array($loader));
$this->assertFalse($resolver->resolve('foo.foo'), '->resolve() returns false if no loader is able to load the resource');
+
+ $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
+ $loader->expects($this->once())->method('supports')->will($this->returnValue(true));
+ $resolver = new LoaderResolver(array($loader));
$this->assertEquals($loader, $resolver->resolve(function () {}), '->resolve() returns the loader for the given resource');
}
/**
- * @covers Symfony\Component\DependencyInjection\Loader\LoaderResolver::getLoaders
- * @covers Symfony\Component\DependencyInjection\Loader\LoaderResolver::addLoader
+ * @covers Symfony\Component\Config\Loader\LoaderResolver::getLoaders
+ * @covers Symfony\Component\Config\Loader\LoaderResolver::addLoader
*/
public function testLoaders()
{
$resolver = new LoaderResolver();
- $resolver->addLoader($loader = new ClosureLoader(new ContainerBuilder()));
+ $resolver->addLoader($loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'));
$this->assertEquals(array($loader), $resolver->getLoaders(), 'addLoader() adds a loader');
}
diff --git a/tests/Symfony/Tests/Component/Routing/Loader/LoaderTest.php b/tests/Symfony/Tests/Component/Config/Loader/LoaderTest.php
similarity index 60%
rename from tests/Symfony/Tests/Component/Routing/Loader/LoaderTest.php
rename to tests/Symfony/Tests/Component/Config/Loader/LoaderTest.php
index a9cc40435e..9c7458d246 100644
--- a/tests/Symfony/Tests/Component/Routing/Loader/LoaderTest.php
+++ b/tests/Symfony/Tests/Component/Config/Loader/LoaderTest.php
@@ -9,17 +9,16 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Tests\Component\Routing\Loader;
+namespace Symfony\Tests\Component\Config\Loader;
-use Symfony\Component\Routing\Loader\LoaderResolver;
-use Symfony\Component\Routing\Loader\Loader;
-use Symfony\Component\Routing\Loader\XmlFileLoader;
+use Symfony\Component\Config\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\Loader;
class LoaderTest extends \PHPUnit_Framework_TestCase
{
/**
- * @covers Symfony\Component\Routing\Loader\Loader::getResolver
- * @covers Symfony\Component\Routing\Loader\Loader::setResolver
+ * @covers Symfony\Component\Config\Loader\Loader::getResolver
+ * @covers Symfony\Component\Config\Loader\Loader::setResolver
*/
public function testGetSetResolver()
{
@@ -30,19 +29,24 @@ class LoaderTest extends \PHPUnit_Framework_TestCase
}
/**
- * @covers Symfony\Component\Routing\Loader\Loader::resolve
+ * @covers Symfony\Component\Config\Loader\Loader::resolve
*/
public function testResolve()
{
- $resolver = new LoaderResolver(array(
- $ini = new XmlFileLoader($this->getMock('Symfony\Component\Routing\Loader\FileLocator')),
- ));
+ $loader1 = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
+ $loader1->expects($this->once())->method('supports')->will($this->returnValue(true));
+ $resolver = new LoaderResolver(array($loader1));
$loader = new ProjectLoader1();
$loader->setResolver($resolver);
- $this->assertSame($ini, $loader->resolve('foo.xml'), '->resolve() finds a loader');
$this->assertSame($loader, $loader->resolve('foo.foo'), '->resolve() finds a loader');
+ $this->assertSame($loader1, $loader->resolve('foo.xml'), '->resolve() finds a loader');
+ $loader1 = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
+ $loader1->expects($this->once())->method('supports')->will($this->returnValue(false));
+ $resolver = new LoaderResolver(array($loader1));
+ $loader = new ProjectLoader1();
+ $loader->setResolver($resolver);
try {
$loader->resolve(new \stdClass());
$this->fail('->resolve() throws an \InvalidArgumentException if the resource cannot be loaded');
diff --git a/tests/Symfony/Tests/Component/DependencyInjection/CrossCheckTest.php b/tests/Symfony/Tests/Component/DependencyInjection/CrossCheckTest.php
index a6e73d8351..8ce4210722 100644
--- a/tests/Symfony/Tests/Component/DependencyInjection/CrossCheckTest.php
+++ b/tests/Symfony/Tests/Component/DependencyInjection/CrossCheckTest.php
@@ -12,7 +12,7 @@
namespace Symfony\Tests\Component\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\FileLocator;
+use Symfony\Component\Config\Loader\FileLocator;
class CrossCheckTest extends \PHPUnit_Framework_TestCase
{
diff --git a/tests/Symfony/Tests/Component/DependencyInjection/Loader/DelegatingLoaderTest.php b/tests/Symfony/Tests/Component/DependencyInjection/Loader/DelegatingLoaderTest.php
deleted file mode 100644
index 026b929355..0000000000
--- a/tests/Symfony/Tests/Component/DependencyInjection/Loader/DelegatingLoaderTest.php
+++ /dev/null
@@ -1,86 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Tests\Component\DependencyInjection\Loader;
-
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
-use Symfony\Component\DependencyInjection\Loader\DelegatingLoader;
-use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
-use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
-use Symfony\Component\DependencyInjection\Loader\FileLocator;
-
-class DelegatingLoaderTest extends \PHPUnit_Framework_TestCase
-{
- /**
- * @covers Symfony\Component\DependencyInjection\Loader\DelegatingLoader::__construct
- */
- public function testConstructor()
- {
- $resolver = new LoaderResolver();
- $loader = new DelegatingLoader($resolver);
- $this->assertTrue(true, '__construct() takes a loader resolver as its first argument');
- }
-
- /**
- * @covers Symfony\Component\DependencyInjection\Loader\DelegatingLoader::getResolver
- * @covers Symfony\Component\DependencyInjection\Loader\DelegatingLoader::setResolver
- */
- public function testGetSetResolver()
- {
- $resolver = new LoaderResolver();
- $loader = new DelegatingLoader($resolver);
- $this->assertSame($resolver, $loader->getResolver(), '->getResolver() gets the resolver loader');
- $loader->setResolver($resolver = new LoaderResolver());
- $this->assertSame($resolver, $loader->getResolver(), '->setResolver() sets the resolver loader');
- }
-
- /**
- * @covers Symfony\Component\DependencyInjection\Loader\DelegatingLoader::supports
- */
- public function testSupports()
- {
- $container = new ContainerBuilder();
- $resolver = new LoaderResolver(array(
- $ini = new IniFileLoader($container, new FileLocator(array())),
- ));
- $loader = new DelegatingLoader($resolver);
-
- $this->assertTrue($loader->supports('foo.ini'), '->supports() returns true if the resource is loadable');
- $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
- }
-
- /**
- * @covers Symfony\Component\DependencyInjection\Loader\DelegatingLoader::load
- */
- public function testLoad()
- {
- $container = new ContainerBuilder();
- $resolver = new LoaderResolver(array(
- new ClosureLoader($container),
- ));
- $loader = new DelegatingLoader($resolver);
-
- $loader->load(function ($container)
- {
- $container->setParameter('foo', 'foo');
- });
-
- $this->assertEquals('foo', $container->getParameter('foo'), '->load() loads a resource using the loaders from the resolver');
-
- try {
- $loader->load('foo.foo');
- $this->fail('->load() throws an \InvalidArgumentException if the resource cannot be loaded');
- } catch (\Exception $e) {
- $this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an \InvalidArgumentException if the resource cannot be loaded');
- }
- }
-}
diff --git a/tests/Symfony/Tests/Component/DependencyInjection/Loader/FileLocatorTest.php b/tests/Symfony/Tests/Component/DependencyInjection/Loader/FileLocatorTest.php
deleted file mode 100644
index 18c567bd62..0000000000
--- a/tests/Symfony/Tests/Component/DependencyInjection/Loader/FileLocatorTest.php
+++ /dev/null
@@ -1,36 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Tests\Component\DependencyInjection\Loader;
-
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\FileLocator;
-
-class FileLocatorTest extends \PHPUnit_Framework_TestCase
-{
- /**
- * @covers Symfony\Component\DependencyInjection\Loader\FileLocator::GetAbsolutePath
- */
- public function testGetAbsolutePath()
- {
- $loader = new FileLocator(array(__DIR__.'/../Fixtures/containers'));
- $this->assertEquals('/foo.xml', $loader->getAbsolutePath('/foo.xml'), '->getAbsolutePath() return the path unmodified if it is already an absolute path');
- $this->assertEquals('c:\\\\foo.xml', $loader->getAbsolutePath('c:\\\\foo.xml'), '->getAbsolutePath() return the path unmodified if it is already an absolute path');
- $this->assertEquals('c:/foo.xml', $loader->getAbsolutePath('c:/foo.xml'), '->getAbsolutePath() return the path unmodified if it is already an absolute path');
- $this->assertEquals('\\server\\foo.xml', $loader->getAbsolutePath('\\server\\foo.xml'), '->getAbsolutePath() return the path unmodified if it is already an absolute path');
-
- $this->assertEquals(__DIR__.DIRECTORY_SEPARATOR.'FileLocatorTest.php', $loader->getAbsolutePath('FileLocatorTest.php', __DIR__), '->getAbsolutePath() returns an absolute filename if the file exists in the current path');
-
- $this->assertEquals(__DIR__.'/../Fixtures/containers'.DIRECTORY_SEPARATOR.'container10.php', $loader->getAbsolutePath('container10.php', __DIR__), '->getAbsolutePath() returns an absolute filename if the file exists in one of the paths given in the constructor');
-
- $this->assertEquals('foo.xml', $loader->getAbsolutePath('foo.xml', __DIR__), '->getAbsolutePath() returns the path unmodified if it is unable to find it in the given paths');
- }
-}
diff --git a/tests/Symfony/Tests/Component/DependencyInjection/Loader/IniFileLoaderTest.php b/tests/Symfony/Tests/Component/DependencyInjection/Loader/IniFileLoaderTest.php
index ef45df5c3d..f5b7299288 100644
--- a/tests/Symfony/Tests/Component/DependencyInjection/Loader/IniFileLoaderTest.php
+++ b/tests/Symfony/Tests/Component/DependencyInjection/Loader/IniFileLoaderTest.php
@@ -13,7 +13,7 @@ namespace Symfony\Tests\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
-use Symfony\Component\DependencyInjection\Loader\FileLocator;
+use Symfony\Component\Config\Loader\FileLocator;
class IniFileLoaderTest extends \PHPUnit_Framework_TestCase
{
diff --git a/tests/Symfony/Tests/Component/DependencyInjection/Loader/LoaderTest.php b/tests/Symfony/Tests/Component/DependencyInjection/Loader/LoaderTest.php
deleted file mode 100644
index ec1f6d1950..0000000000
--- a/tests/Symfony/Tests/Component/DependencyInjection/Loader/LoaderTest.php
+++ /dev/null
@@ -1,78 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Tests\Component\DependencyInjection\Loader;
-
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
-use Symfony\Component\DependencyInjection\Loader\Loader;
-use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
-use Symfony\Component\DependencyInjection\Loader\FileLocator;
-
-class LoaderTest extends \PHPUnit_Framework_TestCase
-{
- /**
- * @covers Symfony\Component\DependencyInjection\Loader\Loader::__construct
- */
- public function testConstructor()
- {
- $loader = new ProjectLoader1(new ContainerBuilder());
- $this->assertTrue(true, '__construct() takes a container builder as its first argument');
- }
-
- /**
- * @covers Symfony\Component\DependencyInjection\Loader\Loader::getResolver
- * @covers Symfony\Component\DependencyInjection\Loader\Loader::setResolver
- */
- public function testGetSetResolver()
- {
- $resolver = new LoaderResolver();
- $loader = new ProjectLoader1(new ContainerBuilder());
- $loader->setResolver($resolver);
- $this->assertSame($resolver, $loader->getResolver(), '->setResolver() sets the resolver loader');
- }
-
- /**
- * @covers Symfony\Component\DependencyInjection\Loader\Loader::resolve
- */
- public function testResolve()
- {
- $container = new ContainerBuilder();
-
- $resolver = new LoaderResolver(array(
- $ini = new IniFileLoader($container, new FileLocator(array())),
- ));
- $loader = new ProjectLoader1($container);
- $loader->setResolver($resolver);
-
- $this->assertSame($ini, $loader->resolve('foo.ini'), '->resolve() finds a loader');
- $this->assertSame($loader, $loader->resolve('foo.foo'), '->resolve() finds a loader');
-
- try {
- $loader->resolve(new \stdClass());
- $this->fail('->resolve() throws an \InvalidArgumentException if the resource cannot be loaded');
- } catch (\Exception $e) {
- $this->assertInstanceOf('\InvalidArgumentException', $e, '->resolve() throws an \InvalidArgumentException if the resource cannot be loaded');
- }
- }
-}
-
-class ProjectLoader1 extends Loader
-{
- public function load($resource)
- {
- }
-
- public function supports($resource)
- {
- return is_string($resource) && 'foo' === pathinfo($resource, PATHINFO_EXTENSION);
- }
-}
diff --git a/tests/Symfony/Tests/Component/DependencyInjection/Loader/PhpFileLoaderTest.php b/tests/Symfony/Tests/Component/DependencyInjection/Loader/PhpFileLoaderTest.php
index 54e0069801..321948f913 100644
--- a/tests/Symfony/Tests/Component/DependencyInjection/Loader/PhpFileLoaderTest.php
+++ b/tests/Symfony/Tests/Component/DependencyInjection/Loader/PhpFileLoaderTest.php
@@ -16,8 +16,8 @@ use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Loader\Loader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
-use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
-use Symfony\Component\DependencyInjection\Loader\FileLocator;
+use Symfony\Component\Config\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\FileLocator;
class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase
{
diff --git a/tests/Symfony/Tests/Component/DependencyInjection/Loader/XmlFileLoaderTest.php b/tests/Symfony/Tests/Component/DependencyInjection/Loader/XmlFileLoaderTest.php
index 0ba99e32b1..cf959395d1 100644
--- a/tests/Symfony/Tests/Component/DependencyInjection/Loader/XmlFileLoaderTest.php
+++ b/tests/Symfony/Tests/Component/DependencyInjection/Loader/XmlFileLoaderTest.php
@@ -20,8 +20,8 @@ use Symfony\Component\DependencyInjection\Loader\Loader;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
-use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
-use Symfony\Component\DependencyInjection\Loader\FileLocator;
+use Symfony\Component\Config\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\FileLocator;
class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
{
diff --git a/tests/Symfony/Tests/Component/DependencyInjection/Loader/YamlFileLoaderTest.php b/tests/Symfony/Tests/Component/DependencyInjection/Loader/YamlFileLoaderTest.php
index 8b0756eb57..099127f55e 100644
--- a/tests/Symfony/Tests/Component/DependencyInjection/Loader/YamlFileLoaderTest.php
+++ b/tests/Symfony/Tests/Component/DependencyInjection/Loader/YamlFileLoaderTest.php
@@ -18,8 +18,8 @@ use Symfony\Component\DependencyInjection\Loader\Loader;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
-use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
-use Symfony\Component\DependencyInjection\Loader\FileLocator;
+use Symfony\Component\Config\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\FileLocator;
class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
{
diff --git a/tests/Symfony/Tests/Component/HttpKernel/KernelTest.php b/tests/Symfony/Tests/Component/HttpKernel/KernelTest.php
index 18542f50f7..f82974c782 100644
--- a/tests/Symfony/Tests/Component/HttpKernel/KernelTest.php
+++ b/tests/Symfony/Tests/Component/HttpKernel/KernelTest.php
@@ -14,9 +14,9 @@ namespace Symfony\Tests\Component\HttpKernel;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;
-use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\Config\Loader\LoaderInterface;
class KernelTest extends \PHPUnit_Framework_TestCase
{
diff --git a/tests/Symfony/Tests/Component/Routing/Loader/AnnotationClassLoaderTest.php b/tests/Symfony/Tests/Component/Routing/Loader/AnnotationClassLoaderTest.php
index 0aec391cde..dd5e296446 100644
--- a/tests/Symfony/Tests/Component/Routing/Loader/AnnotationClassLoaderTest.php
+++ b/tests/Symfony/Tests/Component/Routing/Loader/AnnotationClassLoaderTest.php
@@ -11,7 +11,7 @@
namespace Symfony\Tests\Component\Routing\Loader;
-use Symfony\Component\Routing\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Routing\Loader\AnnotationClassLoader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
diff --git a/tests/Symfony/Tests/Component/Routing/Loader/AnnotationDirectoryLoaderTest.php b/tests/Symfony/Tests/Component/Routing/Loader/AnnotationDirectoryLoaderTest.php
index 15a1f7b30e..aa46677fc9 100644
--- a/tests/Symfony/Tests/Component/Routing/Loader/AnnotationDirectoryLoaderTest.php
+++ b/tests/Symfony/Tests/Component/Routing/Loader/AnnotationDirectoryLoaderTest.php
@@ -11,11 +11,11 @@
namespace Symfony\Tests\Component\Routing\Loader;
-use Symfony\Component\Routing\Loader\LoaderResolver;
use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
-use Symfony\Component\Routing\Loader\FileLocator;
+use Symfony\Component\Config\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\FileLocator;
class AnnotationDirectoryLoaderTest extends \PHPUnit_Framework_TestCase
{
diff --git a/tests/Symfony/Tests/Component/Routing/Loader/AnnotationFileLoaderTest.php b/tests/Symfony/Tests/Component/Routing/Loader/AnnotationFileLoaderTest.php
index 49d1d9f7fa..9325ed0e48 100644
--- a/tests/Symfony/Tests/Component/Routing/Loader/AnnotationFileLoaderTest.php
+++ b/tests/Symfony/Tests/Component/Routing/Loader/AnnotationFileLoaderTest.php
@@ -11,7 +11,7 @@
namespace Symfony\Tests\Component\Routing\Loader;
-use Symfony\Component\Routing\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
@@ -27,7 +27,7 @@ class AnnotationFileLoaderTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMockForAbstractClass();
- $loader = new AnnotationFileLoader($this->getMock('Symfony\Component\Routing\Loader\FileLocator'), $annotationClassLoader);
+ $loader = new AnnotationFileLoader($this->getMock('Symfony\Component\Config\Loader\FileLocator'), $annotationClassLoader);
$fixture = __DIR__.'/../Fixtures/annotated.php';
diff --git a/tests/Symfony/Tests/Component/Routing/Loader/AnnotationGlobLoaderTest.php b/tests/Symfony/Tests/Component/Routing/Loader/AnnotationGlobLoaderTest.php
index f242e72768..e30a132199 100644
--- a/tests/Symfony/Tests/Component/Routing/Loader/AnnotationGlobLoaderTest.php
+++ b/tests/Symfony/Tests/Component/Routing/Loader/AnnotationGlobLoaderTest.php
@@ -11,7 +11,7 @@
namespace Symfony\Tests\Component\Routing\Loader;
-use Symfony\Component\Routing\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Routing\Loader\AnnotationGlobLoader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
@@ -27,7 +27,7 @@ class AnnotationGlobLoaderTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMockForAbstractClass();
- $loader = new AnnotationGlobLoader($this->getMock('Symfony\Component\Routing\Loader\FileLocator'), $annotationClassLoader);
+ $loader = new AnnotationGlobLoader($this->getMock('Symfony\Component\Config\Loader\FileLocator'), $annotationClassLoader);
$this->assertTrue($loader->supports('*'), '->supports() returns true if the resource is loadable');
$this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
diff --git a/tests/Symfony/Tests/Component/Routing/Loader/ClosureLoaderTest.php b/tests/Symfony/Tests/Component/Routing/Loader/ClosureLoaderTest.php
index 8eee98ec98..8eb8cb1a72 100644
--- a/tests/Symfony/Tests/Component/Routing/Loader/ClosureLoaderTest.php
+++ b/tests/Symfony/Tests/Component/Routing/Loader/ClosureLoaderTest.php
@@ -11,7 +11,7 @@
namespace Symfony\Tests\Component\Routing\Loader;
-use Symfony\Component\Routing\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Routing\Loader\ClosureLoader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
diff --git a/tests/Symfony/Tests/Component/Routing/Loader/DelegatingLoaderTest.php b/tests/Symfony/Tests/Component/Routing/Loader/DelegatingLoaderTest.php
deleted file mode 100644
index f97bbc1b87..0000000000
--- a/tests/Symfony/Tests/Component/Routing/Loader/DelegatingLoaderTest.php
+++ /dev/null
@@ -1,89 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Tests\Component\Routing\Loader;
-
-use Symfony\Component\Routing\Loader\LoaderResolver;
-use Symfony\Component\Routing\Loader\DelegatingLoader;
-use Symfony\Component\Routing\Loader\XmlFileLoader;
-use Symfony\Component\Routing\Loader\ClosureLoader;
-use Symfony\Component\Routing\RouteCollection;
-use Symfony\Component\Routing\Route;
-
-class DelegatingLoaderTest extends \PHPUnit_Framework_TestCase
-{
- /**
- * @covers Symfony\Component\Routing\Loader\DelegatingLoader::__construct
- */
- public function testConstructor()
- {
- $resolver = new LoaderResolver();
- $loader = new DelegatingLoader($resolver);
- $this->assertTrue(true, '__construct() takes a loader resolver as its first argument');
- }
-
- /**
- * @covers Symfony\Component\Routing\Loader\DelegatingLoader::getResolver
- * @covers Symfony\Component\Routing\Loader\DelegatingLoader::setResolver
- */
- public function testGetSetResolver()
- {
- $resolver = new LoaderResolver();
- $loader = new DelegatingLoader($resolver);
- $this->assertSame($resolver, $loader->getResolver(), '->getResolver() gets the resolver loader');
- $loader->setResolver($resolver = new LoaderResolver());
- $this->assertSame($resolver, $loader->getResolver(), '->setResolver() sets the resolver loader');
- }
-
- /**
- * @covers Symfony\Component\Routing\Loader\DelegatingLoader::supports
- */
- public function testSupports()
- {
- $resolver = new LoaderResolver(array(
- $ini = new XmlFileLoader($this->getMock('Symfony\Component\Routing\Loader\FileLocator')),
- ));
- $loader = new DelegatingLoader($resolver);
-
- $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');
- }
-
- /**
- * @covers Symfony\Component\Routing\Loader\DelegatingLoader::load
- */
- public function testLoad()
- {
- $resolver = new LoaderResolver(array(
- new ClosureLoader(),
- ));
- $loader = new DelegatingLoader($resolver);
-
- $route = new Route('/');
- $routes = $loader->load(function () use ($route)
- {
- $routes = new RouteCollection();
-
- $routes->add('foo', $route);
-
- return $routes;
- });
-
- $this->assertSame($route, $routes->get('foo'), '->load() loads a resource using the loaders from the resolver');
-
- try {
- $loader->load('foo.foo');
- $this->fail('->load() throws an \InvalidArgumentException if the resource cannot be loaded');
- } catch (\Exception $e) {
- $this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an \InvalidArgumentException if the resource cannot be loaded');
- }
- }
-}
diff --git a/tests/Symfony/Tests/Component/Routing/Loader/LoaderResolverTest.php b/tests/Symfony/Tests/Component/Routing/Loader/LoaderResolverTest.php
deleted file mode 100644
index fa44e984ab..0000000000
--- a/tests/Symfony/Tests/Component/Routing/Loader/LoaderResolverTest.php
+++ /dev/null
@@ -1,55 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Tests\Component\Routing\Loader;
-
-use Symfony\Component\Routing\Loader\LoaderResolver;
-use Symfony\Component\Routing\Loader\ClosureLoader;
-
-class LoaderResolverTest extends \PHPUnit_Framework_TestCase
-{
- /**
- * @covers Symfony\Component\Routing\Loader\LoaderResolver::__construct
- */
- public function testConstructor()
- {
- $resolver = new LoaderResolver(array(
- $loader = new ClosureLoader(),
- ));
-
- $this->assertEquals(array($loader), $resolver->getLoaders(), '__construct() takes an array of loaders as its first argument');
- }
-
- /**
- * @covers Symfony\Component\Routing\Loader\LoaderResolver::resolve
- */
- public function testResolve()
- {
- $resolver = new LoaderResolver(array(
- $loader = new ClosureLoader(),
- ));
-
- $this->assertFalse($resolver->resolve('foo.foo'), '->resolve() returns false if no loader is able to load the resource');
- $this->assertEquals($loader, $resolver->resolve(function () {}), '->resolve() returns the loader for the given resource');
- }
-
- /**
- * @covers Symfony\Component\Routing\Loader\LoaderResolver::getLoaders
- * @covers Symfony\Component\Routing\Loader\LoaderResolver::addLoader
- */
- public function testLoaders()
- {
- $resolver = new LoaderResolver();
- $resolver->addLoader($loader = new ClosureLoader());
-
- $this->assertEquals(array($loader), $resolver->getLoaders(), 'addLoader() adds a loader');
- }
-}
diff --git a/tests/Symfony/Tests/Component/Routing/Loader/PhpFileLoaderTest.php b/tests/Symfony/Tests/Component/Routing/Loader/PhpFileLoaderTest.php
index ba2f4b2c60..f4b43e84e5 100644
--- a/tests/Symfony/Tests/Component/Routing/Loader/PhpFileLoaderTest.php
+++ b/tests/Symfony/Tests/Component/Routing/Loader/PhpFileLoaderTest.php
@@ -11,7 +11,7 @@
namespace Symfony\Tests\Component\Routing\Loader;
-use Symfony\Component\Routing\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Routing\Loader\PhpFileLoader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
@@ -23,7 +23,7 @@ class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase
*/
public function testSupports()
{
- $loader = new PhpFileLoader($this->getMock('Symfony\Component\Routing\Loader\FileLocator'));
+ $loader = new PhpFileLoader($this->getMock('Symfony\Component\Config\Loader\FileLocator'));
$this->assertTrue($loader->supports('foo.php'), '->supports() returns true if the resource is loadable');
$this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
diff --git a/tests/Symfony/Tests/Component/Routing/Loader/XmlFileLoaderTest.php b/tests/Symfony/Tests/Component/Routing/Loader/XmlFileLoaderTest.php
index 55dfdde326..22603cd53b 100644
--- a/tests/Symfony/Tests/Component/Routing/Loader/XmlFileLoaderTest.php
+++ b/tests/Symfony/Tests/Component/Routing/Loader/XmlFileLoaderTest.php
@@ -11,7 +11,7 @@
namespace Symfony\Tests\Component\Routing\Loader;
-use Symfony\Component\Routing\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Routing\Loader\XmlFileLoader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
@@ -23,7 +23,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
*/
public function testSupports()
{
- $loader = new XmlFileLoader($this->getMock('Symfony\Component\Routing\Loader\FileLocator'));
+ $loader = new XmlFileLoader($this->getMock('Symfony\Component\Config\Loader\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');
diff --git a/tests/Symfony/Tests/Component/Routing/Loader/YamlFileLoaderTest.php b/tests/Symfony/Tests/Component/Routing/Loader/YamlFileLoaderTest.php
index 0bf758730c..20ebdaf9a4 100644
--- a/tests/Symfony/Tests/Component/Routing/Loader/YamlFileLoaderTest.php
+++ b/tests/Symfony/Tests/Component/Routing/Loader/YamlFileLoaderTest.php
@@ -11,12 +11,12 @@
namespace Symfony\Tests\Component\Routing\Loader;
-use Symfony\Component\Routing\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\LoaderResolver;
+use Symfony\Component\Config\Loader\FileLocator;
use Symfony\Component\Routing\Loader\YamlFileLoader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Resource\FileResource;
-use Symfony\Component\Routing\Loader\FileLocator;
class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
{
@@ -25,7 +25,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
*/
public function testSupports()
{
- $loader = new YamlFileLoader($this->getMock('Symfony\Component\Routing\Loader\FileLocator'));
+ $loader = new YamlFileLoader($this->getMock('Symfony\Component\Config\Loader\FileLocator'));
$this->assertTrue($loader->supports('foo.yml'), '->supports() returns true if the resource is loadable');
$this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');