This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/tests/Symfony/Tests/Components/DependencyInjection/Loader/PhpFileLoaderTest.php
Fabien Potencier 60c6827f23 [DependencyInjection] refactored loaders
* 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
2010-07-20 13:11:51 +02:00

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');
}
}