PhpFileLoaderTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.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\Component\DependencyInjection\Tests\Loader;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\Config\FileLocator;
  13. use Symfony\Component\DependencyInjection\ContainerBuilder;
  14. use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
  15. class PhpFileLoaderTest extends TestCase
  16. {
  17. public function testSupports()
  18. {
  19. $loader = new PhpFileLoader(new ContainerBuilder(), new FileLocator());
  20. $this->assertTrue($loader->supports('foo.php'), '->supports() returns true if the resource is loadable');
  21. $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
  22. }
  23. public function testLoad()
  24. {
  25. $loader = new PhpFileLoader($container = new ContainerBuilder(), new FileLocator());
  26. $loader->load(__DIR__.'/../Fixtures/php/simple.php');
  27. $this->assertEquals('foo', $container->getParameter('foo'), '->load() loads a PHP file resource');
  28. }
  29. }