RealServiceInstantiatorTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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\Component\DependencyInjection\Tests\LazyProxy\Instantiator;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\DependencyInjection\Definition;
  13. use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator;
  14. /**
  15. * Tests for {@see \Symfony\Component\DependencyInjection\Instantiator\RealServiceInstantiator}.
  16. *
  17. * @author Marco Pivetta <ocramius@gmail.com>
  18. */
  19. class RealServiceInstantiatorTest extends TestCase
  20. {
  21. public function testInstantiateProxy()
  22. {
  23. $instantiator = new RealServiceInstantiator();
  24. $instance = new \stdClass();
  25. $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
  26. $callback = function () use ($instance) {
  27. return $instance;
  28. };
  29. $this->assertSame($instance, $instantiator->instantiateProxy($container, new Definition(), 'foo', $callback));
  30. }
  31. }