60c6827f23
* refactored the import mechanism for better flexibility * added two methods to LoaderInterface: supports() and setResolver() * added a LoaderResolver interface * added a Loader base class * added new loaders: DelegatingLoader, PhpFileLoader, and ClosureLoader
45 lines
1.5 KiB
PHP
45 lines
1.5 KiB
PHP
<?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\Components\DependencyInjection\Loader;
|
|
|
|
use Symfony\Components\DependencyInjection\ContainerBuilder;
|
|
use Symfony\Components\DependencyInjection\Reference;
|
|
use Symfony\Components\DependencyInjection\Definition;
|
|
use Symfony\Components\DependencyInjection\Loader\Loader;
|
|
use Symfony\Components\DependencyInjection\Loader\PhpFileLoader;
|
|
use Symfony\Components\DependencyInjection\Loader\LoaderResolver;
|
|
|
|
class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
/**
|
|
* @covers Symfony\Components\DependencyInjection\Loader\PhpFileLoader::supports
|
|
*/
|
|
public function testSupports()
|
|
{
|
|
$loader = new PhpFileLoader(new ContainerBuilder());
|
|
|
|
$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');
|
|
}
|
|
|
|
/**
|
|
* @covers Symfony\Components\DependencyInjection\Loader\PhpFileLoader::load
|
|
*/
|
|
public function testLoad()
|
|
{
|
|
$loader = new PhpFileLoader($container = new ContainerBuilder());
|
|
|
|
$loader->load(__DIR__.'/../Fixtures/php/simple.php');
|
|
|
|
$this->assertEquals('foo', $container->getParameter('foo'), '->load() loads a PHP file resource');
|
|
}
|
|
}
|