catch (AutowiringFailedException
$e) { $this->
assertSame('Cannot autowire service "a": argument "$r" of method "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\BadParentTypeHintedArgument::__construct()" has type "Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\OptionalServiceClass" but this class couldn\'t be loaded. Either it was not found or it is missing a parent class or a trait.',
$e->
getMessage());
} ClassExistsMock::
withMockedClasses([]);
} public function testDontUseAbstractServices() { $container =
new ContainerBuilder();
$container->
register(Foo::
class)->
setAbstract(true
);
$container->
register('foo', Foo::
class);
$container->
register('bar', Bar::
class)->
setAutowired(true
);
(new ResolveClassPass())->
process($container);
try { (new AutowirePass())->
process($container);
$this->
fail('AutowirePass should have thrown an exception'
);
} catch (AutowiringFailedException
$e) { $this->
assertSame('Cannot autowire service "bar": argument "$foo" of method "Symfony\Component\DependencyInjection\Tests\Compiler\Bar::__construct()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\Foo" but this service is abstract. You should maybe alias this class to the existing "foo" service.',
(string) $e->
getMessage());
} }