AutowireLocator example

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
use Symfony\Component\DependencyInjection\Attribute\AutowireLocator;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Reference;

class AutowireLocatorTest extends TestCase
{
    public function testSimpleLocator()
    {
        $locator = new AutowireLocator('foo', 'bar');

        $this->assertEquals(
            new ServiceLocatorArgument(['foo' => new Reference('foo'), 'bar' => new Reference('bar')]),
            $locator->value,
        );
    }

    public function testComplexLocator()
    {
        $locator = new AutowireLocator(
            '?qux',
            
Home | Imprint | This part of the site doesn't use cookies.