PhpFileLoaderTest.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Tests\Component\DependencyInjection\Loader;
  11. use Symfony\Component\DependencyInjection\ContainerBuilder;
  12. use Symfony\Component\DependencyInjection\Reference;
  13. use Symfony\Component\DependencyInjection\Definition;
  14. use Symfony\Component\DependencyInjection\Loader\Loader;
  15. use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
  16. use Symfony\Component\DependencyInjection\Loader\LoaderResolver;
  17. class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase
  18. {
  19. /**
  20. * @covers Symfony\Component\DependencyInjection\Loader\PhpFileLoader::supports
  21. */
  22. public function testSupports()
  23. {
  24. $loader = new PhpFileLoader(new ContainerBuilder());
  25. $this->assertTrue($loader->supports('foo.php'), '->supports() returns true if the resource is loadable');
  26. $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
  27. }
  28. /**
  29. * @covers Symfony\Component\DependencyInjection\Loader\PhpFileLoader::load
  30. */
  31. public function testLoad()
  32. {
  33. $loader = new PhpFileLoader($container = new ContainerBuilder());
  34. $loader->load(__DIR__.'/../Fixtures/php/simple.php');
  35. $this->assertEquals('foo', $container->getParameter('foo'), '->load() loads a PHP file resource');
  36. }
  37. }