* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\DependencyInjection\Tests\Loader; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; use Symfony\Component\DependencyInjection\Loader\IniFileLoader; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Loader\DirectoryLoader; use Symfony\Component\Config\Loader\LoaderResolver; use Symfony\Component\Config\FileLocator; class DirectoryLoaderTest extends TestCase { private static $fixturesPath; private $container; private $loader; public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } protected function setUp() { $locator = new FileLocator(self::$fixturesPath); $this->container = new ContainerBuilder(); $this->loader = new DirectoryLoader($this->container, $locator); $resolver = new LoaderResolver(array( new PhpFileLoader($this->container, $locator), new IniFileLoader($this->container, $locator), new YamlFileLoader($this->container, $locator), $this->loader, )); $this->loader->setResolver($resolver); } public function testDirectoryCanBeLoadedRecursively() { $this->loader->load('directory/'); $this->assertEquals(array('ini' => 'ini', 'yaml' => 'yaml', 'php' => 'php'), $this->container->getParameterBag()->all(), '->load() takes a single directory'); } public function testImports() { $this->loader->resolve('directory/import/import.yml')->load('directory/import/import.yml'); $this->assertEquals(array('ini' => 'ini', 'yaml' => 'yaml'), $this->container->getParameterBag()->all(), '->load() takes a single file that imports a directory'); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The file "foo" does not exist (in: */ public function testExceptionIsRaisedWhenDirectoryDoesNotExist() { $this->loader->load('foo/'); } public function testSupports() { $loader = new DirectoryLoader(new ContainerBuilder(), new FileLocator()); $this->assertTrue($loader->supports('directory/'), '->supports("directory/") returns true'); $this->assertTrue($loader->supports('directory/', 'directory'), '->supports("directory/", "directory") returns true'); $this->assertFalse($loader->supports('directory'), '->supports("directory") returns false'); $this->assertTrue($loader->supports('directory', 'directory'), '->supports("directory", "directory") returns true'); $this->assertFalse($loader->supports('directory', 'foo'), '->supports("directory", "foo") returns false'); } } __halt_compiler();----SIGNATURE:----olasG/FQus/w+isZ30UKi4ggXvP/vmRzYBkgwTruVm2mQL8R/EU7SkdJx+u5hla7qHo4JDSOSuIkdczV4xJxcvyxoecZC2ImCo72y3hhknddN1pkRunxBEqBr0IbJB6Z/QO3gHVziWPBZoS8jGM4+UrM0QIw4SDCXeVwn7ArjA3yGBZ7PpkdhhUiD63xXldLX1v+k3se9lFmuQpY3SmhHtOHYE3/9QoPiXyVmnkZZNCI4OSiv5XjZ27R9RJXXgAyl+W6GX4KaNWW6iUBtv7/iueyc1ecJclr09sPkOiQKuw4+pKw/p8eUVH5xiel5lHNQv3BkItRvSMmdX8hpD6OhAieNK+sN8oh0aSlQhyVb+lhK466TxgBTMI2lW+1v9MbuetVw9ZU5sdma86kXZrhPDvynbhz5oEGMM3lMydzjL05LZa0RdyCrGPpLw7AE7GwOa56CJjgLai5n5IzrW264M+wQB4oNld6evZvgejigq8GjPzh9lEH264Ba/jlim6E+R/2LGGvgZR2Ckx7ZVtE/KvElvbl9syHibUdIOpMRem64RRA0pC/7k8TB+jUY91O5xoKl1UAFlU8a3trE4SQ9neQkc3IZOXcZfVw9Ha792lUFRgAGIDdzUh8aRVaPC7ZXt2kDugadnTyO7upI+g3dLYHK29DqkP5T1laMZQcs8I=----ATTACHMENT:----Mjc4MTE2NDkzODg5MTg1MyA4ODA4MDYzNzAyNTY2NzM4IDIwODI1NTg5ODAzMjU4MjQ=