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\DependencyInjection\ContainerBuilder;
16 use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
18 class ClosureLoaderTest extends TestCase
20 public function testSupports()
22 $loader = new ClosureLoader(new ContainerBuilder());
24 $this->assertTrue($loader->supports(function ($container) {}), '->supports() returns true if the resource is loadable');
25 $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable');
28 public function testLoad()
30 $loader = new ClosureLoader($container = new ContainerBuilder());
32 $loader->load(function ($container) {
33 $container->setParameter('foo', 'foo');
36 $this->assertEquals('foo', $container->getParameter('foo'), '->load() loads a \Closure resource');