diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddCacheClearerPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddCacheClearerPass.php index 27b9b465c913c..349582b856d89 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddCacheClearerPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddCacheClearerPass.php @@ -33,6 +33,9 @@ public function process(ContainerBuilder $container) $clearers = array(); foreach ($container->findTaggedServiceIds('kernel.cache_clearer') as $id => $attributes) { + if ($container->getDefinition($id)->isAbstract()) { + continue; + } $clearers[] = new Reference($id); } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php index 6510d02c83063..88490ce82058c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php @@ -31,6 +31,9 @@ public function process(ContainerBuilder $container) if ($container->has('router')) { $definition = $container->findDefinition('router'); foreach ($container->findTaggedServiceIds('routing.expression_language_provider') as $id => $attributes) { + if ($container->getDefinition($id)->isAbstract()) { + continue; + } $definition->addMethodCall('addExpressionLanguageProvider', array(new Reference($id))); } } @@ -39,6 +42,9 @@ public function process(ContainerBuilder $container) if ($container->has('security.access.expression_voter')) { $definition = $container->findDefinition('security.access.expression_voter'); foreach ($container->findTaggedServiceIds('security.expression_language_provider') as $id => $attributes) { + if ($container->getDefinition($id)->isAbstract()) { + continue; + } $definition->addMethodCall('addExpressionLanguageProvider', array(new Reference($id))); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php index 882f9b2dccf67..52dd619ad4ba6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php @@ -31,6 +31,9 @@ public function process(ContainerBuilder $container) $pools = array(); foreach ($container->findTaggedServiceIds('cache.pool') as $id => $attributes) { + if ($container->getDefinition($id)->isAbstract()) { + continue; + } $pools[$id] = new Reference($id); foreach (array_reverse($attributes) as $attr) { if (isset($attr['clearer'])) { diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php index 046407351ceeb..f2b0a3678882a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ProfilerPass.php @@ -34,6 +34,9 @@ public function process(ContainerBuilder $container) $collectors = new \SplPriorityQueue(); $order = PHP_INT_MAX; foreach ($container->findTaggedServiceIds('data_collector') as $id => $attributes) { + if ($container->getDefinition($id)->isAbstract()) { + continue; + } $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0; $template = null; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TemplatingPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TemplatingPass.php index 722a014373bd3..e2be26068cd34 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TemplatingPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TemplatingPass.php @@ -33,6 +33,9 @@ public function process(ContainerBuilder $container) if ($container->hasDefinition('templating.engine.php')) { $helpers = array(); foreach ($container->findTaggedServiceIds('templating.helper') as $id => $attributes) { + if ($container->getDefinition($id)->isAbstract()) { + continue; + } if (isset($attributes[0]['alias'])) { $helpers[$attributes[0]['alias']] = $id; } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationDumperPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationDumperPass.php index f7c09748b4f7e..bca342e0d5a6e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationDumperPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationDumperPass.php @@ -29,6 +29,9 @@ public function process(ContainerBuilder $container) $definition = $container->getDefinition('translation.writer'); foreach ($container->findTaggedServiceIds('translation.dumper') as $id => $attributes) { + if ($container->getDefinition($id)->isAbstract()) { + continue; + } $definition->addMethodCall('addDumper', array($attributes[0]['alias'], new Reference($id))); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationExtractorPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationExtractorPass.php index fc8a66d24fa06..d41497ea6633b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationExtractorPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslationExtractorPass.php @@ -30,6 +30,9 @@ public function process(ContainerBuilder $container) $definition = $container->getDefinition('translation.extractor'); foreach ($container->findTaggedServiceIds('translation.extractor') as $id => $attributes) { + if ($container->getDefinition($id)->isAbstract()) { + continue; + } if (!isset($attributes[0]['alias'])) { throw new RuntimeException(sprintf('The alias for the tag "translation.extractor" of service "%s" must be set.', $id)); } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslatorPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslatorPass.php index 3e2d0e24c48a4..6c3c7ce4faa4a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslatorPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TranslatorPass.php @@ -27,6 +27,9 @@ public function process(ContainerBuilder $container) $loaders = array(); $loaderRefs = array(); foreach ($container->findTaggedServiceIds('translation.loader') as $id => $attributes) { + if ($container->getDefinition($id)->isAbstract()) { + continue; + } $loaderRefs[$id] = new Reference($id); $loaders[$id][] = $attributes[0]['alias']; if (isset($attributes[0]['legacy-alias'])) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddCacheWarmerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddCacheWarmerPassTest.php index 799e516dbca38..4fc365fea8639 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddCacheWarmerPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddCacheWarmerPassTest.php @@ -33,7 +33,6 @@ public function testThatCacheWarmersAreProcessedInPriorityOrder() ->will($this->returnValue($services)); $container->expects($this->atLeastOnce()) ->method('getDefinition') - ->with('cache_warmer') ->will($this->returnValue($definition)); $container->expects($this->atLeastOnce()) ->method('hasDefinition') diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ConfigCachePassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ConfigCachePassTest.php index 9c7e29ad36996..a161aed5027be 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ConfigCachePassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ConfigCachePassTest.php @@ -37,7 +37,6 @@ public function testThatCheckersAreProcessedInPriorityOrder() ->will($this->returnValue($services)); $container->expects($this->atLeastOnce()) ->method('getDefinition') - ->with('config_cache_factory') ->will($this->returnValue($definition)); $definition->expects($this->once()) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php index 0bfee565f54fc..7e2feeaabdd3c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\PropertyInfoPass; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; /** @@ -34,12 +35,16 @@ public function testServicesAreOrderedAccordingToPriority() new Reference('n3'), ); - $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds'))->getMock(); + $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds', 'getDefinition'))->getMock(); $container ->expects($this->any()) ->method('findTaggedServiceIds') ->will($this->returnValue($services)); + $container + ->expects($this->any()) + ->method('getDefinition') + ->will($this->returnValue(new Definition())); $propertyInfoPass = new PropertyInfoPass(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php index 29aabf5e1dccb..39f69bff45aa3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/SerializerPassTest.php @@ -12,6 +12,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler; use PHPUnit\Framework\TestCase; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass; @@ -61,7 +62,7 @@ public function testThrowExceptionWhenNoEncoders() array() )); - $container->expects($this->once()) + $container->expects($this->atLeastOnce()) ->method('getDefinition') ->will($this->returnValue($definition)); @@ -85,11 +86,14 @@ public function testServicesAreOrderedAccordingToPriority() new Reference('n3'), ); - $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds'))->getMock(); + $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds', 'getDefinition'))->getMock(); $container->expects($this->any()) ->method('findTaggedServiceIds') ->will($this->returnValue($services)); + $container->expects($this->any()) + ->method('getDefinition') + ->will($this->returnValue(new Definition())); $serializerPass = new SerializerPass(); diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigEnvironmentPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigEnvironmentPass.php index 927e4b46e18ac..bb00cd942d0aa 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigEnvironmentPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigEnvironmentPass.php @@ -37,6 +37,9 @@ public function process(ContainerBuilder $container) $calls = $definition->getMethodCalls(); $definition->setMethodCalls(array()); foreach ($container->findTaggedServiceIds('twig.extension') as $id => $attributes) { + if ($container->getDefinition($id)->isAbstract()) { + continue; + } $definition->addMethodCall('addExtension', array(new Reference($id))); } $definition->setMethodCalls(array_merge($definition->getMethodCalls(), $calls)); diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php index bc3b71c696ed7..90225960518e0 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php @@ -29,27 +29,28 @@ public function process(ContainerBuilder $container) return; } - // register additional template loaders - $loaderIds = $container->findTaggedServiceIds('twig.loader'); + $prioritizedLoaders = array(); + $found = 0; - if (count($loaderIds) === 0) { + foreach ($container->findTaggedServiceIds('twig.loader') as $id => $tags) { + if ($container->getDefinition($id)->isAbstract()) { + continue; + } + foreach ($tags as $tag) { + $priority = isset($tag['priority']) ? $tag['priority'] : 0; + $prioritizedLoaders[$priority][] = $id; + } + ++$found; + } + + if (!$found) { throw new LogicException('No twig loaders found. You need to tag at least one loader with "twig.loader"'); } - if (count($loaderIds) === 1) { - $container->setAlias('twig.loader', key($loaderIds)); + if (1 === $found) { + $container->setAlias('twig.loader', current($prioritizedLoaders)[0]); } else { $chainLoader = $container->getDefinition('twig.loader.chain'); - - $prioritizedLoaders = array(); - - foreach ($loaderIds as $id => $tags) { - foreach ($tags as $tag) { - $priority = isset($tag['priority']) ? $tag['priority'] : 0; - $prioritizedLoaders[$priority][] = $id; - } - } - krsort($prioritizedLoaders); foreach ($prioritizedLoaders as $loaders) { diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php index 10bcf3e8f66a8..e04a57f1abbf6 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php @@ -53,6 +53,9 @@ public function testMapperPassWithOneTaggedLoaders() ->method('findTaggedServiceIds') ->with('twig.loader') ->will($this->returnValue($serviceIds)); + $this->builder->expects($this->once()) + ->method('getDefinition') + ->will($this->returnValue(new Definition())); $this->builder->expects($this->once()) ->method('setAlias') ->with('twig.loader', 'test_loader_1'); @@ -79,10 +82,11 @@ public function testMapperPassWithTwoTaggedLoaders() ->method('findTaggedServiceIds') ->with('twig.loader') ->will($this->returnValue($serviceIds)); - $this->builder->expects($this->once()) + $this->builder->expects($this->exactly(3)) ->method('getDefinition') - ->with('twig.loader.chain') - ->will($this->returnValue($this->chainLoader)); + ->withConsecutive(array('test_loader_1'), array('test_loader_2'), array('twig.loader.chain')) + ->willReturnOnConsecutiveCalls(new Definition(), new Definition(), $this->chainLoader); + $this->builder->expects($this->once()) ->method('setAlias') ->with('twig.loader', 'twig.loader.chain'); @@ -115,10 +119,10 @@ public function testMapperPassWithTwoTaggedLoadersWithPriority() ->method('findTaggedServiceIds') ->with('twig.loader') ->will($this->returnValue($serviceIds)); - $this->builder->expects($this->once()) + $this->builder->expects($this->exactly(3)) ->method('getDefinition') - ->with('twig.loader.chain') - ->will($this->returnValue($this->chainLoader)); + ->withConsecutive(array('test_loader_1'), array('test_loader_2'), array('twig.loader.chain')) + ->willReturnOnConsecutiveCalls(new Definition(), new Definition(), $this->chainLoader); $this->builder->expects($this->once()) ->method('setAlias') ->with('twig.loader', 'twig.loader.chain'); diff --git a/src/Symfony/Component/Config/Tests/DependencyInjection/ConfigCachePassTest.php b/src/Symfony/Component/Config/Tests/DependencyInjection/ConfigCachePassTest.php index 3c5c88a5041d7..de64b6dec4b88 100644 --- a/src/Symfony/Component/Config/Tests/DependencyInjection/ConfigCachePassTest.php +++ b/src/Symfony/Component/Config/Tests/DependencyInjection/ConfigCachePassTest.php @@ -34,7 +34,6 @@ public function testThatCheckersAreProcessedInPriorityOrder() ->will($this->returnValue($services)); $container->expects($this->atLeastOnce()) ->method('getDefinition') - ->with('config_cache_factory') ->will($this->returnValue($definition)); $definition->expects($this->once()) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php b/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php index 83f6014c39357..007c0a83b8843 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php @@ -41,6 +41,9 @@ private function findAndSortTaggedServices($tagName, ContainerBuilder $container $services = array(); foreach ($container->findTaggedServiceIds($tagName) as $serviceId => $tags) { + if ($container->getDefinition($serviceId)->isAbstract()) { + continue; + } foreach ($tags as $attributes) { $priority = isset($attributes['priority']) ? $attributes['priority'] : 0; $services[$priority][] = new Reference($serviceId); diff --git a/src/Symfony/Component/Form/DependencyInjection/FormPass.php b/src/Symfony/Component/Form/DependencyInjection/FormPass.php index 9952210cedaa7..f1b973ee53fc4 100644 --- a/src/Symfony/Component/Form/DependencyInjection/FormPass.php +++ b/src/Symfony/Component/Form/DependencyInjection/FormPass.php @@ -63,6 +63,9 @@ private function processFormTypes(ContainerBuilder $container, Definition $defin // Builds an array with fully-qualified type class names as keys and service IDs as values foreach ($container->findTaggedServiceIds($this->formTypeTag) as $serviceId => $tag) { $serviceDefinition = $container->getDefinition($serviceId); + if ($serviceDefinition->isAbstract()) { + continue; + } // Add form type service to the service locator $servicesMap[$serviceDefinition->getClass()] = new Reference($serviceId); diff --git a/src/Symfony/Component/PropertyInfo/Tests/DependencyInjection/PropertyInfoPassTest.php b/src/Symfony/Component/PropertyInfo/Tests/DependencyInjection/PropertyInfoPassTest.php index 065f8afc88f4d..f24c3ef903fd0 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/DependencyInjection/PropertyInfoPassTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/DependencyInjection/PropertyInfoPassTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\PropertyInfo\Tests\DependencyInjection; use PHPUnit\Framework\TestCase; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass; @@ -31,12 +32,16 @@ public function testServicesAreOrderedAccordingToPriority() new Reference('n3'), ); - $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds'))->getMock(); + $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds', 'getDefinition'))->getMock(); $container ->expects($this->any()) ->method('findTaggedServiceIds') ->will($this->returnValue($services)); + $container + ->expects($this->any()) + ->method('getDefinition') + ->will($this->returnValue(new Definition())); $propertyInfoPass = new PropertyInfoPass(); diff --git a/src/Symfony/Component/Routing/DependencyInjection/RoutingResolverPass.php b/src/Symfony/Component/Routing/DependencyInjection/RoutingResolverPass.php index 5a31471f6be87..085c501ce95e6 100644 --- a/src/Symfony/Component/Routing/DependencyInjection/RoutingResolverPass.php +++ b/src/Symfony/Component/Routing/DependencyInjection/RoutingResolverPass.php @@ -40,6 +40,9 @@ public function process(ContainerBuilder $container) $definition = $container->getDefinition($this->resolverServiceId); foreach ($container->findTaggedServiceIds($this->loaderTag) as $id => $attributes) { + if ($container->getDefinition($id)->isAbstract()) { + continue; + } $definition->addMethodCall('addLoader', array(new Reference($id))); } } diff --git a/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php b/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php index e68c1f188b7d8..c6d6a7bab0ec8 100644 --- a/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php +++ b/src/Symfony/Component/Serializer/Tests/DependencyInjection/SerializerPassTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Serializer\Tests\DependencyInjection; use PHPUnit\Framework\TestCase; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\Serializer\DependencyInjection\SerializerPass; @@ -59,7 +60,7 @@ public function testThrowExceptionWhenNoEncoders() array() )); - $container->expects($this->once()) + $container->expects($this->atLeastOnce()) ->method('getDefinition') ->will($this->returnValue($definition)); @@ -83,11 +84,14 @@ public function testServicesAreOrderedAccordingToPriority() new Reference('n3'), ); - $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds'))->getMock(); + $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds', 'getDefinition'))->getMock(); $container->expects($this->any()) ->method('findTaggedServiceIds') ->will($this->returnValue($services)); + $container->expects($this->any()) + ->method('getDefinition') + ->will($this->returnValue(new Definition())); $serializerPass = new SerializerPass();