Yaffs site version 1.1
[yaffs-website] / vendor / symfony / dependency-injection / Tests / Loader / ClosureLoaderTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\DependencyInjection\Tests\Loader;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\DependencyInjection\ContainerBuilder;
16 use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
17
18 class ClosureLoaderTest extends TestCase
19 {
20     public function testSupports()
21     {
22         $loader = new ClosureLoader(new ContainerBuilder());
23
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');
26     }
27
28     public function testLoad()
29     {
30         $loader = new ClosureLoader($container = new ContainerBuilder());
31
32         $loader->load(function ($container) {
33             $container->setParameter('foo', 'foo');
34         });
35
36         $this->assertEquals('foo', $container->getParameter('foo'), '->load() loads a \Closure resource');
37     }
38 }