PhpFileLoaderTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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\Tests\Component\DependencyInjection\Loader;
  11. use Symfony\Component\DependencyInjection\ContainerBuilder;
  12. use Symfony\Component\Config\Loader\Loader;
  13. use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
  14. use Symfony\Component\Config\FileLocator;
  15. class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase
  16. {
  17. /**
  18. * @covers Symfony\Component\DependencyInjection\Loader\PhpFileLoader::supports
  19. */
  20. public function testSupports()
  21. {
  22. $loader = new PhpFileLoader(new ContainerBuilder(), new FileLocator());
  23. $this->assertTrue($loader->supports('foo.php'), '->supports() returns true if the resource is loadable');
  24. $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
  25. }
  26. /**
  27. * @covers Symfony\Component\DependencyInjection\Loader\PhpFileLoader::load
  28. */
  29. public function testLoad()
  30. {
  31. $loader = new PhpFileLoader($container = new ContainerBuilder(), new FileLocator());
  32. $loader->load(__DIR__.'/../Fixtures/php/simple.php');
  33. $this->assertEquals('foo', $container->getParameter('foo'), '->load() loads a PHP file resource');
  34. }
  35. }