[DependencyInjection] Tests for AutowirePass with missing parent class

This commit is contained in:
Martin Hasoň 2016-03-31 14:26:29 +02:00 committed by Nicolas Grekas
parent d1038c3421
commit 1735b85c04
2 changed files with 33 additions and 0 deletions

View File

@ -397,6 +397,21 @@ class AutowirePassTest extends \PHPUnit_Framework_TestCase
$definition->getArguments()
);
}
public function testIgnoreServiceWithClassNotExisting()
{
$container = new ContainerBuilder();
$container->register('class_not_exist', __NAMESPACE__.'\OptionalServiceClass');
$barDefinition = $container->register('bar', __NAMESPACE__.'\Bar');
$barDefinition->setAutowired(true);
$pass = new AutowirePass();
$pass->process($container);
$this->assertTrue($container->hasDefinition('bar'));
}
}
class Foo

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use Symfony\Bug\NotExistClass;
class OptionalServiceClass extends NotExistClass
{
}