Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / dependency-injection / Tests / Compiler / ResolveInvalidReferencesPassTest.php
index 8cf4e5186cd1c7f719e68145ac8e094df2cb89c4..00613ba5c1c6ce6afd1b126325ee07133547ce4d 100644 (file)
@@ -12,6 +12,7 @@
 namespace Symfony\Component\DependencyInjection\Tests\Compiler;
 
 use PHPUnit\Framework\TestCase;
+use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\DependencyInjection\Reference;
 use Symfony\Component\DependencyInjection\Compiler\ResolveInvalidReferencesPass;
@@ -108,6 +109,24 @@ class ResolveInvalidReferencesPassTest extends TestCase
         $this->assertEquals(array(), $def->getProperties());
     }
 
+    public function testProcessRemovesArgumentsOnInvalid()
+    {
+        $container = new ContainerBuilder();
+        $def = $container
+            ->register('foo')
+            ->addArgument(array(
+                array(
+                    new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE),
+                    new ServiceClosureArgument(new Reference('baz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)),
+                ),
+            ))
+        ;
+
+        $this->process($container);
+
+        $this->assertSame(array(array(array())), $def->getArguments());
+    }
+
     protected function process(ContainerBuilder $container)
     {
         $pass = new ResolveInvalidReferencesPass();