Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / dependency-injection / Tests / Compiler / FactoryReturnTypePassTest.php
index 65722f4fde98711eebfdedd8e0a11d77337a2bdd..f299463d5f44ad992dc85c2a6c0a59160bf44bc2 100644 (file)
@@ -21,6 +21,8 @@ use Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryParent;
 
 /**
  * @author Guilhem N. <egetick@gmail.com>
+ *
+ * @group legacy
  */
 class FactoryReturnTypePassTest extends TestCase
 {
@@ -104,22 +106,16 @@ class FactoryReturnTypePassTest extends TestCase
         $this->assertNull($factory2->getClass());
     }
 
+    /**
+     * @requires function ReflectionMethod::getReturnType
+     * @expectedDeprecation Relying on its factory's return-type to define the class of service "factory" is deprecated since Symfony 3.3 and won't work in 4.0. Set the "class" attribute to "Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy" on the service definition instead.
+     */
     public function testCompile()
     {
         $container = new ContainerBuilder();
 
         $factory = $container->register('factory');
         $factory->setFactory(array(FactoryDummy::class, 'createFactory'));
-
-        if (!method_exists(\ReflectionMethod::class, 'getReturnType')) {
-            if (method_exists($this, 'expectException')) {
-                $this->expectException(\RuntimeException::class);
-                $this->expectExceptionMessage('Please add the class to service "factory" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.');
-            } else {
-                $this->setExpectedException(\RuntimeException::class, 'Please add the class to service "factory" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.');
-            }
-        }
-
         $container->compile();
 
         $this->assertEquals(FactoryDummy::class, $container->getDefinition('factory')->getClass());