PhpFileLoaderTest.php 1.5 KB

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