4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\DependencyInjection\Tests\Loader;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Config\FileLocator;
16 use Symfony\Component\Config\Resource\GlobResource;
17 use Symfony\Component\DependencyInjection\ContainerBuilder;
18 use Symfony\Component\DependencyInjection\Loader\GlobFileLoader;
20 class GlobFileLoaderTest extends TestCase
22 public function testSupports()
24 $loader = new GlobFileLoader(new ContainerBuilder(), new FileLocator());
26 $this->assertTrue($loader->supports('any-path', 'glob'), '->supports() returns true if the resource has the glob type');
27 $this->assertFalse($loader->supports('any-path'), '->supports() returns false if the resource is not of glob type');
30 public function testLoadAddsTheGlobResourceToTheContainer()
32 $loader = new GlobFileLoaderWithoutImport($container = new ContainerBuilder(), new FileLocator());
33 $loader->load(__DIR__.'/../Fixtures/config/*');
35 $this->assertEquals(new GlobResource(__DIR__.'/../Fixtures/config', '/*', false), $container->getResources()[1]);
39 class GlobFileLoaderWithoutImport extends GlobFileLoader
41 public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null)