Revert "moved Resource to the Config component"
This reverts commitf53080860a
. Revert "[Router] config fixes" This reverts commit51beecc6f2
. Revert "moved duplicated files to a new Config component" This reverts commita8ec9b27f0
.
This commit is contained in:
parent
f53080860a
commit
b91f082be5
@ -15,7 +15,7 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
|||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This abstract classes groups common code that Doctrine Object Manager extensions (ORM, MongoDB, CouchDB) need.
|
* This abstract classes groups common code that Doctrine Object Manager extensions (ORM, MongoDB, CouchDB) need.
|
||||||
|
@ -14,12 +14,12 @@ namespace Symfony\Bundle\DoctrineBundle\DependencyInjection;
|
|||||||
use Symfony\Component\DependencyInjection\Alias;
|
use Symfony\Component\DependencyInjection\Alias;
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||||
use Symfony\Bundle\DoctrineAbstractBundle\DependencyInjection\AbstractDoctrineExtension;
|
use Symfony\Bundle\DoctrineAbstractBundle\DependencyInjection\AbstractDoctrineExtension;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DoctrineExtension is an extension for the Doctrine DBAL and ORM library.
|
* DoctrineExtension is an extension for the Doctrine DBAL and ORM library.
|
||||||
|
@ -18,7 +18,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
|||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
abstract class AbstractDoctrineExtensionTest extends TestCase
|
abstract class AbstractDoctrineExtensionTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class XmlDoctrineExtensionTest extends AbstractDoctrineExtensionTest
|
class XmlDoctrineExtensionTest extends AbstractDoctrineExtensionTest
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class YamlDoctrineExtensionTest extends AbstractDoctrineExtensionTest
|
class YamlDoctrineExtensionTest extends AbstractDoctrineExtensionTest
|
||||||
{
|
{
|
||||||
|
@ -13,12 +13,12 @@ namespace Symfony\Bundle\DoctrineMongoDBBundle\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Alias;
|
use Symfony\Component\DependencyInjection\Alias;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
|
||||||
use Symfony\Bundle\DoctrineAbstractBundle\DependencyInjection\AbstractDoctrineExtension;
|
use Symfony\Bundle\DoctrineAbstractBundle\DependencyInjection\AbstractDoctrineExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Bundle\DoctrineMongoDBBundle\Tests\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class XmlMongoDBExtensionTest extends AbstractMongoDBExtensionTest
|
class XmlMongoDBExtensionTest extends AbstractMongoDBExtensionTest
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Bundle\DoctrineMongoDBBundle\Tests\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class YamlMongoDBExtensionTest extends AbstractMongoDBExtensionTest
|
class YamlMongoDBExtensionTest extends AbstractMongoDBExtensionTest
|
||||||
{
|
{
|
||||||
|
@ -17,10 +17,10 @@ use Symfony\Component\DependencyInjection\Parameter;
|
|||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\Configuration\Processor;
|
use Symfony\Component\DependencyInjection\Configuration\Processor;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FrameworkExtension.
|
* FrameworkExtension.
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
<parameter key="router.class">Symfony\Component\Routing\Router</parameter>
|
<parameter key="router.class">Symfony\Component\Routing\Router</parameter>
|
||||||
<parameter key="router.cached.class">Symfony\Bundle\FrameworkBundle\Routing\CachedRouter</parameter>
|
<parameter key="router.cached.class">Symfony\Bundle\FrameworkBundle\Routing\CachedRouter</parameter>
|
||||||
<parameter key="routing.loader.class">Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader</parameter>
|
<parameter key="routing.loader.class">Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader</parameter>
|
||||||
<parameter key="routing.file_locator.class">Symfony\Component\HttpKernel\Config\Loader\FileLocator</parameter>
|
<parameter key="routing.file_locator.class">Symfony\Bundle\FrameworkBundle\Routing\FileLocator</parameter>
|
||||||
<parameter key="routing.resolver.class">Symfony\Component\Config\Loader\LoaderResolver</parameter>
|
<parameter key="routing.resolver.class">Symfony\Component\Routing\Loader\LoaderResolver</parameter>
|
||||||
<parameter key="routing.loader.xml.class">Symfony\Component\Routing\Loader\XmlFileLoader</parameter>
|
<parameter key="routing.loader.xml.class">Symfony\Component\Routing\Loader\XmlFileLoader</parameter>
|
||||||
<parameter key="routing.loader.yml.class">Symfony\Component\Routing\Loader\YamlFileLoader</parameter>
|
<parameter key="routing.loader.yml.class">Symfony\Component\Routing\Loader\YamlFileLoader</parameter>
|
||||||
<parameter key="routing.loader.php.class">Symfony\Component\Routing\Loader\PhpFileLoader</parameter>
|
<parameter key="routing.loader.php.class">Symfony\Component\Routing\Loader\PhpFileLoader</parameter>
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
namespace Symfony\Bundle\FrameworkBundle\Routing;
|
namespace Symfony\Bundle\FrameworkBundle\Routing;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
|
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
|
||||||
use Symfony\Component\Config\Loader\DelegatingLoader as BaseDelegatingLoader;
|
use Symfony\Component\Routing\Loader\DelegatingLoader as BaseDelegatingLoader;
|
||||||
use Symfony\Component\Config\Loader\LoaderResolverInterface;
|
use Symfony\Component\Routing\Loader\LoaderResolverInterface;
|
||||||
use Symfony\Component\HttpKernel\Log\LoggerInterface;
|
use Symfony\Component\HttpKernel\Log\LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\HttpKernel\Config\Loader;
|
namespace Symfony\Bundle\FrameworkBundle\Routing;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\FileLocator as BaseFileLocator;
|
use Symfony\Component\Routing\Loader\FileLocator as BaseFileLocator;
|
||||||
use Symfony\Component\HttpKernel\KernelInterface;
|
use Symfony\Component\HttpKernel\KernelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Routing;
|
namespace Symfony\Bundle\FrameworkBundle\Routing;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
use Symfony\Component\Routing\Loader\LoaderInterface;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\Routing\Loader\LoaderResolver as BaseLoaderResolver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LazyLoader facilitate lazy loading of loader services.
|
* LazyLoader facilitate lazy loading of loader services.
|
||||||
@ -78,7 +78,7 @@ class LazyLoader implements LoaderInterface
|
|||||||
*
|
*
|
||||||
* @param LoaderResolver $resolver A LoaderResolver instance
|
* @param LoaderResolver $resolver A LoaderResolver instance
|
||||||
*/
|
*/
|
||||||
public function setResolver(LoaderResolver $resolver)
|
public function setResolver(BaseLoaderResolver $resolver)
|
||||||
{
|
{
|
||||||
$this->container->get($this->service)->setResolver($resolver);
|
$this->container->get($this->service)->setResolver($resolver);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class PhpFrameworkExtensionTest extends FrameworkExtensionTest
|
class PhpFrameworkExtensionTest extends FrameworkExtensionTest
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class XmlFrameworkExtensionTest extends FrameworkExtensionTest
|
class XmlFrameworkExtensionTest extends FrameworkExtensionTest
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class YamlFrameworkExtensionTest extends FrameworkExtensionTest
|
class YamlFrameworkExtensionTest extends FrameworkExtensionTest
|
||||||
{
|
{
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
namespace Symfony\Bundle\FrameworkBundle\Tests;
|
namespace Symfony\Bundle\FrameworkBundle\Tests;
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Util\Filesystem;
|
use Symfony\Bundle\FrameworkBundle\Util\Filesystem;
|
||||||
use Symfony\Component\ClassLoader\UniversalClassLoader;
|
use Symfony\Component\ClassLoader\UniversalClassLoader;
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
|
||||||
|
|
||||||
class Kernel extends BaseKernel
|
class Kernel extends BaseKernel
|
||||||
{
|
{
|
||||||
|
@ -17,13 +17,13 @@ use Symfony\Component\DependencyInjection\DefinitionDecorator;
|
|||||||
use Symfony\Component\DependencyInjection\Alias;
|
use Symfony\Component\DependencyInjection\Alias;
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\Parameter;
|
use Symfony\Component\DependencyInjection\Parameter;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
|
||||||
use Symfony\Component\HttpFoundation\RequestMatcher;
|
use Symfony\Component\HttpFoundation\RequestMatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class PhpSecurityExtensionTest extends SecurityExtensionTest
|
class PhpSecurityExtensionTest extends SecurityExtensionTest
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class XmlSecurityExtensionTest extends SecurityExtensionTest
|
class XmlSecurityExtensionTest extends SecurityExtensionTest
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class YamlSecurityExtensionTest extends SecurityExtensionTest
|
class YamlSecurityExtensionTest extends SecurityExtensionTest
|
||||||
{
|
{
|
||||||
|
@ -13,9 +13,9 @@ namespace Symfony\Bundle\SwiftmailerBundle\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SwiftMailerExtension is an extension for the SwiftMailer library.
|
* SwiftMailerExtension is an extension for the SwiftMailer library.
|
||||||
|
@ -15,7 +15,7 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
|||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TwigExtension.
|
* TwigExtension.
|
||||||
|
@ -13,11 +13,11 @@ namespace Symfony\Bundle\WebProfilerBundle\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WebProfilerExtension.
|
* WebProfilerExtension.
|
||||||
|
@ -13,8 +13,8 @@ namespace Symfony\Bundle\ZendBundle\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ZendExtension is an extension for the Zend Framework libraries.
|
* ZendExtension is an extension for the Zend Framework libraries.
|
||||||
|
@ -17,8 +17,8 @@ use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
|||||||
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
||||||
use Symfony\Component\DependencyInjection\InterfaceInjector;
|
use Symfony\Component\DependencyInjection\InterfaceInjector;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||||
use Symfony\Component\Config\Resource\ResourceInterface;
|
use Symfony\Component\DependencyInjection\Resource\ResourceInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ContainerBuilder is a DI container that provides an API to easily describe services.
|
* ContainerBuilder is a DI container that provides an API to easily describe services.
|
||||||
|
@ -11,9 +11,6 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\DependencyInjection\Loader;
|
namespace Symfony\Component\DependencyInjection\Loader;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
||||||
use Symfony\Component\Config\Loader\Loader;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClosureLoader loads service definitions from a PHP closure.
|
* ClosureLoader loads service definitions from a PHP closure.
|
||||||
*
|
*
|
||||||
@ -23,18 +20,6 @@ use Symfony\Component\Config\Loader\Loader;
|
|||||||
*/
|
*/
|
||||||
class ClosureLoader extends Loader
|
class ClosureLoader extends Loader
|
||||||
{
|
{
|
||||||
protected $container;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
|
||||||
*/
|
|
||||||
public function __construct(ContainerBuilder $container)
|
|
||||||
{
|
|
||||||
$this->container = $container;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a Closure.
|
* Loads a Closure.
|
||||||
*
|
*
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Config\Loader;
|
namespace Symfony\Component\DependencyInjection\Loader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DelegatingLoader delegates loading to other loaders using a loader resolver.
|
* DelegatingLoader delegates loading to other loaders using a loader resolver.
|
@ -12,17 +12,16 @@
|
|||||||
namespace Symfony\Component\DependencyInjection\Loader;
|
namespace Symfony\Component\DependencyInjection\Loader;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\Config\Loader\FileLoader as BaseFileLoader;
|
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FileLoader is the abstract class used by all built-in loaders that are file based.
|
* FileLoader is the abstract class used by all built-in loaders that are file based.
|
||||||
*
|
*
|
||||||
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
*/
|
*/
|
||||||
abstract class FileLoader extends BaseFileLoader
|
abstract class FileLoader extends Loader
|
||||||
{
|
{
|
||||||
protected $container;
|
protected $locator;
|
||||||
|
protected $currentDir;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@ -31,8 +30,35 @@ abstract class FileLoader extends BaseFileLoader
|
|||||||
*/
|
*/
|
||||||
public function __construct(ContainerBuilder $container, FileLocator $locator)
|
public function __construct(ContainerBuilder $container, FileLocator $locator)
|
||||||
{
|
{
|
||||||
$this->container = $container;
|
$this->locator = $locator;
|
||||||
|
|
||||||
parent::__construct($locator);
|
parent::__construct($container);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLocator()
|
||||||
|
{
|
||||||
|
return $this->locator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds definitions and parameters from a resource.
|
||||||
|
*
|
||||||
|
* @param mixed $resource A Resource
|
||||||
|
*/
|
||||||
|
public function import($resource, $ignoreErrors = false)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$loader = $this->resolve($resource);
|
||||||
|
|
||||||
|
if ($loader instanceof FileLoader && null !== $this->currentDir) {
|
||||||
|
$resource = $this->locator->getAbsolutePath($resource, $this->currentDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$loader->load($resource);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
if (!$ignoreErrors) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
101
src/Symfony/Component/DependencyInjection/Loader/FileLocator.php
Normal file
101
src/Symfony/Component/DependencyInjection/Loader/FileLocator.php
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\DependencyInjection\Loader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FileLocator uses an array of pre-defined paths to find files.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*/
|
||||||
|
class FileLocator
|
||||||
|
{
|
||||||
|
protected $paths;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string|array $paths A path or an array of paths where to look for resources
|
||||||
|
*/
|
||||||
|
public function __construct($paths = array())
|
||||||
|
{
|
||||||
|
if (!is_array($paths)) {
|
||||||
|
$paths = array($paths);
|
||||||
|
}
|
||||||
|
$this->paths = $paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a full path for a given file.
|
||||||
|
*
|
||||||
|
* @param string $file A file path
|
||||||
|
* @param string $currentPath The current path
|
||||||
|
*
|
||||||
|
* @return string The full path for the file
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException When file is not found
|
||||||
|
*/
|
||||||
|
public function locate($file, $currentPath = null)
|
||||||
|
{
|
||||||
|
$path = $this->getAbsolutePath($file, $currentPath);
|
||||||
|
if (!file_exists($path)) {
|
||||||
|
throw new \InvalidArgumentException(sprintf('The file "%s" does not exist (in: %s).', $file, implode(', ', $this->paths)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the absolute path for the file path if possible.
|
||||||
|
*
|
||||||
|
* @param string $file A file path
|
||||||
|
* @param string $currentPath The current path
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getAbsolutePath($file, $currentPath = null)
|
||||||
|
{
|
||||||
|
if ($this->isAbsolutePath($file)) {
|
||||||
|
return $file;
|
||||||
|
} else if (null !== $currentPath && file_exists($currentPath.DIRECTORY_SEPARATOR.$file)) {
|
||||||
|
return $currentPath.DIRECTORY_SEPARATOR.$file;
|
||||||
|
} else {
|
||||||
|
foreach ($this->paths as $path) {
|
||||||
|
if (file_exists($path.DIRECTORY_SEPARATOR.$file)) {
|
||||||
|
return $path.DIRECTORY_SEPARATOR.$file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the file path is an absolute path.
|
||||||
|
*
|
||||||
|
* @param string $file A file path
|
||||||
|
*
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
|
public function isAbsolutePath($file)
|
||||||
|
{
|
||||||
|
if ($file[0] == '/' || $file[0] == '\\'
|
||||||
|
|| (strlen($file) > 3 && ctype_alpha($file[0])
|
||||||
|
&& $file[1] == ':'
|
||||||
|
&& ($file[2] == '\\' || $file[2] == '/')
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Component\DependencyInjection\Loader;
|
namespace Symfony\Component\DependencyInjection\Loader;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IniFileLoader loads parameters from INI files.
|
* IniFileLoader loads parameters from INI files.
|
||||||
|
@ -9,7 +9,9 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Config\Loader;
|
namespace Symfony\Component\DependencyInjection\Loader;
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loader is the abstract class used by all built-in loaders.
|
* Loader is the abstract class used by all built-in loaders.
|
||||||
@ -18,8 +20,19 @@ namespace Symfony\Component\Config\Loader;
|
|||||||
*/
|
*/
|
||||||
abstract class Loader implements LoaderInterface
|
abstract class Loader implements LoaderInterface
|
||||||
{
|
{
|
||||||
|
protected $container;
|
||||||
protected $resolver;
|
protected $resolver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||||
|
*/
|
||||||
|
public function __construct(ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
$this->container = $container;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the loader resolver.
|
* Gets the loader resolver.
|
||||||
*
|
*
|
@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\DependencyInjection\Loader;
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LoaderInterface is the interface implemented by all loader classes.
|
||||||
|
*
|
||||||
|
* $loader = new XXXLoader();
|
||||||
|
* $config = $loader->load('resource_name');
|
||||||
|
*
|
||||||
|
* $container = new ContainerBuilder();
|
||||||
|
* $container->merge($config);
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*/
|
||||||
|
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):
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* file1.xml
|
||||||
|
* <parameter key="complex" type="collection">
|
||||||
|
* <parameter>true</parameter>
|
||||||
|
* <parameter>false</parameter>
|
||||||
|
* </parameter>
|
||||||
|
*
|
||||||
|
* file2.xml
|
||||||
|
* <parameter key="complex">foo</parameter>
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* 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);
|
||||||
|
}
|
@ -9,13 +9,14 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Config\Loader;
|
namespace Symfony\Component\DependencyInjection\Loader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LoaderResolver selects a loader for a given resource.
|
* LoaderResolver selects a loader for a given resource.
|
||||||
*
|
*
|
||||||
* A resource can be anything (e.g. a full path to a config file or a Closure).
|
* A resource can be anything that can be converted to a ContainerBuilder
|
||||||
* Each loader determines whether it can load a resource and how.
|
* instance (e.g. a full path to a config file or a Closure). Each
|
||||||
|
* loader determines whether it can load a resource and how.
|
||||||
*
|
*
|
||||||
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
*/
|
*/
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Config\Loader;
|
namespace Symfony\Component\DependencyInjection\Loader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LoaderResolverInterface selects a loader for a given resource.
|
* LoaderResolverInterface selects a loader for a given resource.
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\DependencyInjection\Loader;
|
namespace Symfony\Component\DependencyInjection\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PhpFileLoader loads service definitions from a PHP file.
|
* PhpFileLoader loads service definitions from a PHP file.
|
||||||
|
@ -20,7 +20,7 @@ use Symfony\Component\DependencyInjection\Definition;
|
|||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\SimpleXMLElement;
|
use Symfony\Component\DependencyInjection\SimpleXMLElement;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XmlFileLoader loads XML files service definitions.
|
* XmlFileLoader loads XML files service definitions.
|
||||||
|
@ -19,7 +19,7 @@ use Symfony\Component\DependencyInjection\InterfaceInjector;
|
|||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\DependencyInjection\Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FileResource represents a resource stored on the filesystem.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*/
|
||||||
|
class FileResource implements ResourceInterface
|
||||||
|
{
|
||||||
|
protected $resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $resource The file path to the resource
|
||||||
|
*/
|
||||||
|
public function __construct($resource)
|
||||||
|
{
|
||||||
|
$this->resource = realpath($resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string representation of the Resource.
|
||||||
|
*
|
||||||
|
* @return string A string representation of the Resource
|
||||||
|
*/
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return (string) $this->resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the resource tied to this Resource.
|
||||||
|
*
|
||||||
|
* @return mixed The resource
|
||||||
|
*/
|
||||||
|
public function getResource()
|
||||||
|
{
|
||||||
|
return $this->resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the resource has not been updated since the given timestamp.
|
||||||
|
*
|
||||||
|
* @param timestamp $timestamp The last time the resource was loaded
|
||||||
|
*
|
||||||
|
* @return Boolean true if the resource has not been updated, false otherwise
|
||||||
|
*/
|
||||||
|
public function isUptodate($timestamp)
|
||||||
|
{
|
||||||
|
if (!file_exists($this->resource)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return filemtime($this->resource) < $timestamp;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\DependencyInjection\Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ResourceInterface is the interface that must be implemented by all Resource classes.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*/
|
||||||
|
interface ResourceInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns a string representation of the Resource.
|
||||||
|
*
|
||||||
|
* @return string A string representation of the Resource
|
||||||
|
*/
|
||||||
|
function __toString();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the resource has not been updated since the given timestamp.
|
||||||
|
*
|
||||||
|
* @param int $timestamp The last time the resource was loaded
|
||||||
|
*
|
||||||
|
* @return Boolean true if the resource has not been updated, false otherwise
|
||||||
|
*/
|
||||||
|
function isUptodate($timestamp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the resource tied to this Resource.
|
||||||
|
*
|
||||||
|
* @return mixed The resource
|
||||||
|
*/
|
||||||
|
function getResource();
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* 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 <fabien.potencier@symfony-project.com>
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,9 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
|
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
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\XmlFileLoader;
|
||||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||||
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
|
||||||
@ -23,9 +26,7 @@ use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||||
use Symfony\Component\HttpKernel\Config\Loader\FileLocator;
|
use Symfony\Component\HttpKernel\DependencyInjection\Loader\FileLocator;
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
|
||||||
use Symfony\Component\Config\Loader\DelegatingLoader;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Kernel is the heart of the Symfony system.
|
* The Kernel is the heart of the Symfony system.
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
namespace Symfony\Component\HttpKernel;
|
namespace Symfony\Component\HttpKernel;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
|
||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Kernel is the heart of the Symfony system.
|
* The Kernel is the heart of the Symfony system.
|
||||||
|
@ -438,9 +438,9 @@ class HttpKernel implements HttpKernelInterface
|
|||||||
namespace Symfony\Component\HttpKernel
|
namespace Symfony\Component\HttpKernel
|
||||||
{
|
{
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
|
||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
|
||||||
interface KernelInterface extends HttpKernelInterface, \Serializable
|
interface KernelInterface extends HttpKernelInterface, \Serializable
|
||||||
{
|
{
|
||||||
function registerRootDir();
|
function registerRootDir();
|
||||||
@ -469,6 +469,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|||||||
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
|
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||||
use Symfony\Component\DependencyInjection\Loader\DelegatingLoader;
|
use Symfony\Component\DependencyInjection\Loader\DelegatingLoader;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
|
||||||
use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
|
use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
namespace Symfony\Component\HttpKernel
|
namespace Symfony\Component\HttpKernel
|
||||||
{
|
{
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
|
||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
|
||||||
interface KernelInterface extends HttpKernelInterface, \Serializable
|
interface KernelInterface extends HttpKernelInterface, \Serializable
|
||||||
{
|
{
|
||||||
function registerRootDir();
|
function registerRootDir();
|
||||||
@ -33,6 +33,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|||||||
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
|
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||||
use Symfony\Component\DependencyInjection\Loader\DelegatingLoader;
|
use Symfony\Component\DependencyInjection\Loader\DelegatingLoader;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
|
||||||
use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
|
use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||||
|
@ -13,11 +13,10 @@ namespace Symfony\Component\Routing\Loader;
|
|||||||
|
|
||||||
use Doctrine\Common\Annotations\AnnotationReader;
|
use Doctrine\Common\Annotations\AnnotationReader;
|
||||||
use Symfony\Component\Routing\Annotation\Route as RouteAnnotation;
|
use Symfony\Component\Routing\Annotation\Route as RouteAnnotation;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\Routing\Loader\LoaderResolver;
|
||||||
|
use Symfony\Component\Routing\Resource\FileResource;
|
||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
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.
|
* AnnotationClassLoader loads routing information from a PHP class and its methods.
|
||||||
|
@ -12,9 +12,7 @@
|
|||||||
namespace Symfony\Component\Routing\Loader;
|
namespace Symfony\Component\Routing\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
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
|
* AnnotationFileLoader loads routing information from annotations set
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Routing\Loader;
|
namespace Symfony\Component\Routing\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\Loader;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClosureLoader loads routes from a PHP closure.
|
* ClosureLoader loads routes from a PHP closure.
|
||||||
*
|
*
|
||||||
|
80
src/Symfony/Component/Routing/Loader/DelegatingLoader.php
Normal file
80
src/Symfony/Component/Routing/Loader/DelegatingLoader.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* 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 <fabien.potencier@symfony-project.com>
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -9,7 +9,9 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Config\Loader;
|
namespace Symfony\Component\Routing\Loader;
|
||||||
|
|
||||||
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FileLoader is the abstract class used by all built-in loaders that are file based.
|
* FileLoader is the abstract class used by all built-in loaders that are file based.
|
||||||
@ -21,9 +23,6 @@ abstract class FileLoader extends Loader
|
|||||||
protected $locator;
|
protected $locator;
|
||||||
protected $currentDir;
|
protected $currentDir;
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*/
|
|
||||||
public function __construct(FileLocator $locator)
|
public function __construct(FileLocator $locator)
|
||||||
{
|
{
|
||||||
$this->locator = $locator;
|
$this->locator = $locator;
|
||||||
@ -35,24 +34,21 @@ abstract class FileLoader extends Loader
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds definitions and parameters from a resource.
|
* Adds routes from a resource.
|
||||||
*
|
*
|
||||||
* @param mixed $resource A Resource
|
* @param mixed $resource A Resource
|
||||||
|
* @param string $type The resource type
|
||||||
|
*
|
||||||
|
* @return RouteCollection A RouteCollection instance
|
||||||
*/
|
*/
|
||||||
public function import($resource, $ignoreErrors = false)
|
public function import($resource, $type = null)
|
||||||
{
|
{
|
||||||
try {
|
$loader = $this->resolve($resource, $type);
|
||||||
$loader = $this->resolve($resource);
|
|
||||||
|
|
||||||
if ($loader instanceof FileLoader && null !== $this->currentDir) {
|
if ($loader instanceof FileLoader && null !== $this->currentDir) {
|
||||||
$resource = $this->locator->getAbsolutePath($resource, $this->currentDir);
|
$resource = $this->locator->getAbsolutePath($resource, $this->currentDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
$loader->load($resource);
|
return $loader->load($resource, $type);
|
||||||
} catch (\Exception $e) {
|
|
||||||
if (!$ignoreErrors) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Config\Loader;
|
namespace Symfony\Component\Routing\Loader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FileLocator uses an array of pre-defined paths to find files.
|
* FileLocator uses an array of pre-defined paths to find files.
|
79
src/Symfony/Component/Routing/Loader/Loader.php
Normal file
79
src/Symfony/Component/Routing/Loader/Loader.php
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* 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 <fabien.potencier@symfony-project.com>
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -9,10 +9,12 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Config\Loader;
|
namespace Symfony\Component\Routing\Loader;
|
||||||
|
|
||||||
|
use Symfony\Component\Routing\Loader\LoaderResolver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LoaderInterface is the interface implemented by all loader classes.
|
* LoaderInterface is the interface that all loader classes must implement.
|
||||||
*
|
*
|
||||||
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
*/
|
*/
|
||||||
@ -21,18 +23,22 @@ interface LoaderInterface
|
|||||||
/**
|
/**
|
||||||
* Loads a resource.
|
* Loads a resource.
|
||||||
*
|
*
|
||||||
* @param mixed $resource The resource
|
* @param mixed $resource A resource
|
||||||
|
* @param string $type The resource type
|
||||||
|
*
|
||||||
|
* @return RouteCollection A RouteCollection instance
|
||||||
*/
|
*/
|
||||||
function load($resource);
|
function load($resource, $type = null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this class supports the given resource.
|
* Returns true if this class supports the given resource.
|
||||||
*
|
*
|
||||||
* @param mixed $resource A resource
|
* @param mixed $resource A resource
|
||||||
|
* @param string $type The resource type
|
||||||
*
|
*
|
||||||
* @return Boolean true if this class supports the given resource, false otherwise
|
* @return Boolean True if this class supports the given resource, false otherwise
|
||||||
*/
|
*/
|
||||||
function supports($resource);
|
function supports($resource, $type = null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the loader resolver.
|
* Gets the loader resolver.
|
75
src/Symfony/Component/Routing/Loader/LoaderResolver.php
Normal file
75
src/Symfony/Component/Routing/Loader/LoaderResolver.php
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* 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 <fabien.potencier@symfony-project.com>
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* 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 <fabien.potencier@symfony-project.com>
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
@ -11,8 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Routing\Loader;
|
namespace Symfony\Component\Routing\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\Routing\Resource\FileResource;
|
||||||
use Symfony\Component\Config\Loader\FileLoader;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PhpFileLoader loads routes from a PHP file.
|
* PhpFileLoader loads routes from a PHP file.
|
||||||
|
@ -13,8 +13,7 @@ namespace Symfony\Component\Routing\Loader;
|
|||||||
|
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\Routing\Resource\FileResource;
|
||||||
use Symfony\Component\Config\Loader\FileLoader;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XmlFileLoader loads XML routing files.
|
* XmlFileLoader loads XML routing files.
|
||||||
|
@ -13,9 +13,8 @@ namespace Symfony\Component\Routing\Loader;
|
|||||||
|
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\Routing\Resource\FileResource;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
use Symfony\Component\Config\Loader\FileLoader;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* YamlFileLoader loads Yaml routing files.
|
* YamlFileLoader loads Yaml routing files.
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Config\Resource;
|
namespace Symfony\Component\Routing\Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FileResource represents a resource stored on the filesystem.
|
* FileResource represents a resource stored on the filesystem.
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Config\Resource;
|
namespace Symfony\Component\Routing\Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResourceInterface is the interface that must be implemented by all Resource classes.
|
* ResourceInterface is the interface that must be implemented by all Resource classes.
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Routing;
|
namespace Symfony\Component\Routing;
|
||||||
|
|
||||||
use Symfony\Component\Config\Resource\ResourceInterface;
|
use Symfony\Component\Routing\Resource\ResourceInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A RouteCollection represents a set of Route instances.
|
* A RouteCollection represents a set of Route instances.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Routing;
|
namespace Symfony\Component\Routing;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
use Symfony\Component\Routing\Loader\LoaderInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Router class is an example of the integration of all pieces of the
|
* The Router class is an example of the integration of all pieces of the
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Translation\Loader;
|
namespace Symfony\Component\Translation\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\Translation\Resource\FileResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CsvFileLoader loads translations from CSV files.
|
* CsvFileLoader loads translations from CSV files.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Translation\Loader;
|
namespace Symfony\Component\Translation\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\Translation\Resource\FileResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PhpFileLoader loads translations from PHP files returning an array of translations.
|
* PhpFileLoader loads translations from PHP files returning an array of translations.
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Component\Translation\Loader;
|
namespace Symfony\Component\Translation\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Translation\MessageCatalogue;
|
use Symfony\Component\Translation\MessageCatalogue;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\Translation\Resource\FileResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XliffFileLoader loads translations from XLIFF files.
|
* XliffFileLoader loads translations from XLIFF files.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Translation\Loader;
|
namespace Symfony\Component\Translation\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\Translation\Resource\FileResource;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Translation;
|
namespace Symfony\Component\Translation;
|
||||||
|
|
||||||
use Symfony\Component\Config\Resource\ResourceInterface;
|
use Symfony\Component\Translation\Resource\ResourceInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MessageCatalogue.
|
* MessageCatalogue.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Translation;
|
namespace Symfony\Component\Translation;
|
||||||
|
|
||||||
use Symfony\Component\Config\Resource\ResourceInterface;
|
use Symfony\Component\Translation\Resource\ResourceInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MessageCatalogueInterface.
|
* MessageCatalogueInterface.
|
||||||
|
60
src/Symfony/Component/Translation/Resource/FileResource.php
Normal file
60
src/Symfony/Component/Translation/Resource/FileResource.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\Translation\Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FileResource represents a resource stored on the filesystem.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*/
|
||||||
|
class FileResource implements ResourceInterface
|
||||||
|
{
|
||||||
|
protected $resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $resource The file path to the resource
|
||||||
|
*/
|
||||||
|
public function __construct($resource)
|
||||||
|
{
|
||||||
|
if (!file_exists($resource)) {
|
||||||
|
throw new \InvalidArgumentException(sprintf('Resource "%s" does not exist.', $resource));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->resource = realpath($resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return (string) $this->resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getResource()
|
||||||
|
{
|
||||||
|
return $this->resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function isUptodate($timestamp)
|
||||||
|
{
|
||||||
|
return filemtime($this->resource) < $timestamp;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\Translation\Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ResourceInterface is the interface that must be implemented by all Resource classes.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*/
|
||||||
|
interface ResourceInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns a string representation of the Resource.
|
||||||
|
*
|
||||||
|
* @return string A string representation of the Resource
|
||||||
|
*/
|
||||||
|
function __toString();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the resource has not been updated since the given timestamp.
|
||||||
|
*
|
||||||
|
* @param int $timestamp The last time the resource was loaded
|
||||||
|
*
|
||||||
|
* @return Boolean true if the resource has not been updated, false otherwise
|
||||||
|
*/
|
||||||
|
function isUptodate($timestamp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the resource tied to this Resource.
|
||||||
|
*
|
||||||
|
* @return mixed The resource
|
||||||
|
*/
|
||||||
|
function getResource();
|
||||||
|
}
|
@ -1,87 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the Symfony package.
|
|
||||||
*
|
|
||||||
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
||||||
*
|
|
||||||
* 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');
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,7 +18,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||||
|
|
||||||
require_once __DIR__.'/Fixtures/includes/classes.php';
|
require_once __DIR__.'/Fixtures/includes/classes.php';
|
||||||
require_once __DIR__.'/Fixtures/includes/ProjectExtension.php';
|
require_once __DIR__.'/Fixtures/includes/ProjectExtension.php';
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Tests\Component\DependencyInjection;
|
namespace Symfony\Tests\Component\DependencyInjection;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class CrossCheckTest extends \PHPUnit_Framework_TestCase
|
class CrossCheckTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* 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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* 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');
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,7 @@ namespace Symfony\Tests\Component\DependencyInjection\Loader;
|
|||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class IniFileLoaderTest extends \PHPUnit_Framework_TestCase
|
class IniFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -9,47 +9,47 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Tests\Component\Config\Loader;
|
namespace Symfony\Tests\Component\DependencyInjection\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
|
||||||
|
|
||||||
class LoaderResolverTest extends \PHPUnit_Framework_TestCase
|
class LoaderResolverTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @covers Symfony\Component\Config\Loader\LoaderResolver::__construct
|
* @covers Symfony\Component\DependencyInjection\Loader\LoaderResolver::__construct
|
||||||
*/
|
*/
|
||||||
public function testConstructor()
|
public function testConstructor()
|
||||||
{
|
{
|
||||||
$resolver = new LoaderResolver(array(
|
$resolver = new LoaderResolver(array(
|
||||||
$loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'),
|
$loader = new ClosureLoader(new ContainerBuilder()),
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertEquals(array($loader), $resolver->getLoaders(), '__construct() takes an array of loaders as its first argument');
|
$this->assertEquals(array($loader), $resolver->getLoaders(), '__construct() takes an array of loaders as its first argument');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers Symfony\Component\Config\Loader\LoaderResolver::resolve
|
* @covers Symfony\Component\DependencyInjection\Loader\LoaderResolver::resolve
|
||||||
*/
|
*/
|
||||||
public function testResolve()
|
public function testResolve()
|
||||||
{
|
{
|
||||||
$loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
|
$resolver = new LoaderResolver(array(
|
||||||
$resolver = new LoaderResolver(array($loader));
|
$loader = new ClosureLoader(new ContainerBuilder()),
|
||||||
$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');
|
$this->assertFalse($resolver->resolve('foo.foo'), '->resolve() returns false if no loader is able to load the resource');
|
||||||
$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');
|
$this->assertEquals($loader, $resolver->resolve(function () {}), '->resolve() returns the loader for the given resource');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers Symfony\Component\Config\Loader\LoaderResolver::getLoaders
|
* @covers Symfony\Component\DependencyInjection\Loader\LoaderResolver::getLoaders
|
||||||
* @covers Symfony\Component\Config\Loader\LoaderResolver::addLoader
|
* @covers Symfony\Component\DependencyInjection\Loader\LoaderResolver::addLoader
|
||||||
*/
|
*/
|
||||||
public function testLoaders()
|
public function testLoaders()
|
||||||
{
|
{
|
||||||
$resolver = new LoaderResolver();
|
$resolver = new LoaderResolver();
|
||||||
$resolver->addLoader($loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'));
|
$resolver->addLoader($loader = new ClosureLoader(new ContainerBuilder()));
|
||||||
|
|
||||||
$this->assertEquals(array($loader), $resolver->getLoaders(), 'addLoader() adds a loader');
|
$this->assertEquals(array($loader), $resolver->getLoaders(), 'addLoader() adds a loader');
|
||||||
}
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
@ -16,8 +16,8 @@ use Symfony\Component\DependencyInjection\Reference;
|
|||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\DependencyInjection\Loader\Loader;
|
use Symfony\Component\DependencyInjection\Loader\Loader;
|
||||||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase
|
class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -20,8 +20,8 @@ use Symfony\Component\DependencyInjection\Loader\Loader;
|
|||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||||
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -18,8 +18,8 @@ use Symfony\Component\DependencyInjection\Loader\Loader;
|
|||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||||
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\DependencyInjection\Loader\FileLocator;
|
||||||
|
|
||||||
class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Tests\Component\Config\Resource;
|
namespace Symfony\Tests\Component\DependencyInjection\Resource;
|
||||||
|
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||||
|
|
||||||
class FileResourceTest extends \PHPUnit_Framework_TestCase
|
class FileResourceTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -31,7 +31,7 @@ class FileResourceTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers Symfony\Component\Config\Resource\FileResource::getResource
|
* @covers Symfony\Component\DependencyInjection\Resource\FileResource::getResource
|
||||||
*/
|
*/
|
||||||
public function testGetResource()
|
public function testGetResource()
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ class FileResourceTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers Symfony\Component\Config\Resource\FileResource::isUptodate
|
* @covers Symfony\Component\DependencyInjection\Resource\FileResource::isUptodate
|
||||||
*/
|
*/
|
||||||
public function testIsUptodate()
|
public function testIsUptodate()
|
||||||
{
|
{
|
@ -14,9 +14,9 @@ namespace Symfony\Tests\Component\HttpKernel;
|
|||||||
use Symfony\Component\HttpKernel\Kernel;
|
use Symfony\Component\HttpKernel\Kernel;
|
||||||
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
|
||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
|
||||||
|
|
||||||
class KernelTest extends \PHPUnit_Framework_TestCase
|
class KernelTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Tests\Component\Routing\Loader;
|
namespace Symfony\Tests\Component\Routing\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\Routing\Loader\LoaderResolver;
|
||||||
use Symfony\Component\Routing\Loader\AnnotationClassLoader;
|
use Symfony\Component\Routing\Loader\AnnotationClassLoader;
|
||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
namespace Symfony\Tests\Component\Routing\Loader;
|
namespace Symfony\Tests\Component\Routing\Loader;
|
||||||
|
|
||||||
|
use Symfony\Component\Routing\Loader\LoaderResolver;
|
||||||
use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
|
use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
|
||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\Routing\Loader\FileLocator;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
|
||||||
|
|
||||||
class AnnotationDirectoryLoaderTest extends \PHPUnit_Framework_TestCase
|
class AnnotationDirectoryLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Tests\Component\Routing\Loader;
|
namespace Symfony\Tests\Component\Routing\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\Routing\Loader\LoaderResolver;
|
||||||
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
|
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
|
||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
@ -27,7 +27,7 @@ class AnnotationFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMockForAbstractClass();
|
->getMockForAbstractClass();
|
||||||
|
|
||||||
$loader = new AnnotationFileLoader($this->getMock('Symfony\Component\Config\Loader\FileLocator'), $annotationClassLoader);
|
$loader = new AnnotationFileLoader($this->getMock('Symfony\Component\Routing\Loader\FileLocator'), $annotationClassLoader);
|
||||||
|
|
||||||
$fixture = __DIR__.'/../Fixtures/annotated.php';
|
$fixture = __DIR__.'/../Fixtures/annotated.php';
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Tests\Component\Routing\Loader;
|
namespace Symfony\Tests\Component\Routing\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\Routing\Loader\LoaderResolver;
|
||||||
use Symfony\Component\Routing\Loader\AnnotationGlobLoader;
|
use Symfony\Component\Routing\Loader\AnnotationGlobLoader;
|
||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
@ -27,7 +27,7 @@ class AnnotationGlobLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMockForAbstractClass();
|
->getMockForAbstractClass();
|
||||||
|
|
||||||
$loader = new AnnotationGlobLoader($this->getMock('Symfony\Component\Config\Loader\FileLocator'), $annotationClassLoader);
|
$loader = new AnnotationGlobLoader($this->getMock('Symfony\Component\Routing\Loader\FileLocator'), $annotationClassLoader);
|
||||||
|
|
||||||
$this->assertTrue($loader->supports('*'), '->supports() returns true if the resource is loadable');
|
$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');
|
$this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Tests\Component\Routing\Loader;
|
namespace Symfony\Tests\Component\Routing\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\Routing\Loader\LoaderResolver;
|
||||||
use Symfony\Component\Routing\Loader\ClosureLoader;
|
use Symfony\Component\Routing\Loader\ClosureLoader;
|
||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
|
@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* 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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,15 +9,15 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Tests\Component\Config\Loader;
|
namespace Symfony\Tests\Component\Routing\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
use Symfony\Component\Routing\Loader\FileLocator;
|
||||||
|
|
||||||
class FileLocatorTest extends \PHPUnit_Framework_TestCase
|
class FileLocatorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @covers Symfony\Component\Config\Loader\FileLocator::GetAbsolutePath
|
* @covers Symfony\Component\Routing\Loader\FileLocator::GetAbsolutePath
|
||||||
* @covers Symfony\Component\Config\Loader\FileLocator::isAbsolutePath
|
* @covers Symfony\Component\Routing\Loader\FileLocator::isAbsolutePath
|
||||||
*/
|
*/
|
||||||
public function testGetAbsolutePath()
|
public function testGetAbsolutePath()
|
||||||
{
|
{
|
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* 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');
|
||||||
|
}
|
||||||
|
}
|
@ -9,16 +9,17 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Tests\Component\Config\Loader;
|
namespace Symfony\Tests\Component\Routing\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\Routing\Loader\LoaderResolver;
|
||||||
use Symfony\Component\Config\Loader\Loader;
|
use Symfony\Component\Routing\Loader\Loader;
|
||||||
|
use Symfony\Component\Routing\Loader\XmlFileLoader;
|
||||||
|
|
||||||
class LoaderTest extends \PHPUnit_Framework_TestCase
|
class LoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @covers Symfony\Component\Config\Loader\Loader::getResolver
|
* @covers Symfony\Component\Routing\Loader\Loader::getResolver
|
||||||
* @covers Symfony\Component\Config\Loader\Loader::setResolver
|
* @covers Symfony\Component\Routing\Loader\Loader::setResolver
|
||||||
*/
|
*/
|
||||||
public function testGetSetResolver()
|
public function testGetSetResolver()
|
||||||
{
|
{
|
||||||
@ -29,24 +30,19 @@ class LoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers Symfony\Component\Config\Loader\Loader::resolve
|
* @covers Symfony\Component\Routing\Loader\Loader::resolve
|
||||||
*/
|
*/
|
||||||
public function testResolve()
|
public function testResolve()
|
||||||
{
|
{
|
||||||
$loader1 = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface');
|
$resolver = new LoaderResolver(array(
|
||||||
$loader1->expects($this->once())->method('supports')->will($this->returnValue(true));
|
$ini = new XmlFileLoader($this->getMock('Symfony\Component\Routing\Loader\FileLocator')),
|
||||||
$resolver = new LoaderResolver(array($loader1));
|
));
|
||||||
$loader = new ProjectLoader1();
|
$loader = new ProjectLoader1();
|
||||||
$loader->setResolver($resolver);
|
$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($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 {
|
try {
|
||||||
$loader->resolve(new \stdClass());
|
$loader->resolve(new \stdClass());
|
||||||
$this->fail('->resolve() throws an \InvalidArgumentException if the resource cannot be loaded');
|
$this->fail('->resolve() throws an \InvalidArgumentException if the resource cannot be loaded');
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Tests\Component\Routing\Loader;
|
namespace Symfony\Tests\Component\Routing\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\Routing\Loader\LoaderResolver;
|
||||||
use Symfony\Component\Routing\Loader\PhpFileLoader;
|
use Symfony\Component\Routing\Loader\PhpFileLoader;
|
||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
@ -23,7 +23,7 @@ class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testSupports()
|
public function testSupports()
|
||||||
{
|
{
|
||||||
$loader = new PhpFileLoader($this->getMock('Symfony\Component\Config\Loader\FileLocator'));
|
$loader = new PhpFileLoader($this->getMock('Symfony\Component\Routing\Loader\FileLocator'));
|
||||||
|
|
||||||
$this->assertTrue($loader->supports('foo.php'), '->supports() returns true if the resource is loadable');
|
$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');
|
$this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Tests\Component\Routing\Loader;
|
namespace Symfony\Tests\Component\Routing\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\Routing\Loader\LoaderResolver;
|
||||||
use Symfony\Component\Routing\Loader\XmlFileLoader;
|
use Symfony\Component\Routing\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
@ -23,7 +23,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testSupports()
|
public function testSupports()
|
||||||
{
|
{
|
||||||
$loader = new XmlFileLoader($this->getMock('Symfony\Component\Config\Loader\FileLocator'));
|
$loader = new XmlFileLoader($this->getMock('Symfony\Component\Routing\Loader\FileLocator'));
|
||||||
|
|
||||||
$this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable');
|
$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');
|
$this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
|
||||||
|
@ -11,12 +11,12 @@
|
|||||||
|
|
||||||
namespace Symfony\Tests\Component\Routing\Loader;
|
namespace Symfony\Tests\Component\Routing\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
use Symfony\Component\Routing\Loader\LoaderResolver;
|
||||||
use Symfony\Component\Config\Loader\FileLocator;
|
|
||||||
use Symfony\Component\Routing\Loader\YamlFileLoader;
|
use Symfony\Component\Routing\Loader\YamlFileLoader;
|
||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\Routing\Resource\FileResource;
|
||||||
|
use Symfony\Component\Routing\Loader\FileLocator;
|
||||||
|
|
||||||
class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -25,7 +25,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testSupports()
|
public function testSupports()
|
||||||
{
|
{
|
||||||
$loader = new YamlFileLoader($this->getMock('Symfony\Component\Config\Loader\FileLocator'));
|
$loader = new YamlFileLoader($this->getMock('Symfony\Component\Routing\Loader\FileLocator'));
|
||||||
|
|
||||||
$this->assertTrue($loader->supports('foo.yml'), '->supports() returns true if the resource is loadable');
|
$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');
|
$this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Tests\Component\Routing\Resource;
|
||||||
|
|
||||||
|
use Symfony\Component\Routing\Resource\FileResource;
|
||||||
|
|
||||||
|
class FileResourceTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function testGetResource()
|
||||||
|
{
|
||||||
|
$file = sys_get_temp_dir().'/tmp.xml';
|
||||||
|
touch($file);
|
||||||
|
$resource = new FileResource($file);
|
||||||
|
$this->assertEquals(realpath($file), $resource->getResource(), '->getResource() returns the path to the resource');
|
||||||
|
unlink($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testIsUptodate()
|
||||||
|
{
|
||||||
|
$file = sys_get_temp_dir().'/tmp.xml';
|
||||||
|
touch($file);
|
||||||
|
$resource = new FileResource($file);
|
||||||
|
$this->assertTrue($resource->isUptodate(time() + 10), '->isUptodate() returns true if the resource has not changed');
|
||||||
|
$this->assertTrue(!$resource->isUptodate(time() - 86400), '->isUptodate() returns false if the resource has been updated');
|
||||||
|
|
||||||
|
$resource = new FileResource('/____foo/foobar'.rand(1, 999999));
|
||||||
|
$this->assertTrue(!$resource->isUptodate(time()), '->isUptodate() returns false if the resource does not exist');
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,7 @@ namespace Symfony\Tests\Component\Routing;
|
|||||||
|
|
||||||
use Symfony\Component\Routing\RouteCollection;
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\Routing\Resource\FileResource;
|
||||||
|
|
||||||
class RouteCollectionTest extends \PHPUnit_Framework_TestCase
|
class RouteCollectionTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Tests\Component\Translation\Loader;
|
namespace Symfony\Tests\Component\Translation\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Translation\Loader\CsvFileLoader;
|
use Symfony\Component\Translation\Loader\CsvFileLoader;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\Translation\Resource\FileResource;
|
||||||
|
|
||||||
class CsvFileLoaderTest extends \PHPUnit_Framework_TestCase
|
class CsvFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Tests\Component\Translation\Loader;
|
namespace Symfony\Tests\Component\Translation\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Translation\Loader\PhpFileLoader;
|
use Symfony\Component\Translation\Loader\PhpFileLoader;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\Translation\Resource\FileResource;
|
||||||
|
|
||||||
class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase
|
class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user