Code Duplication    Length = 28-30 lines in 2 locations

Tests/DependencyInjection/CustomHandlerPassTest.php 1 location

@@ 37-64 (lines=28) @@
34
     * @param array $configs
35
     * @return ContainerBuilder
36
     */
37
    private function getContainer(array $configs = array())
38
    {
39
        $loader = new JMSSerializerExtension();
40
        $container = new ContainerBuilder();
41
42
        $container->getCompilerPassConfig()->setOptimizationPasses(array(
43
            new ResolveParameterPlaceHoldersPass(),
44
            new ResolveDefinitionTemplatesPass(),
45
        ));
46
        $container->getCompilerPassConfig()->setRemovingPasses(array(new RemoveUnusedDefinitionsPass()));
47
48
        $container->setParameter('kernel.debug', true);
49
        $container->setParameter('kernel.cache_dir', sys_get_temp_dir() . '/serializer');
50
        $container->setParameter('kernel.bundles', array());
51
        $container->setParameter('kernel.bundles', array());
52
53
        $loader->load(['jms_serializer' => $configs], $container);
54
55
        // remove other subscribers
56
        foreach (array_keys($container->findTaggedServiceIds('jms_serializer.handler')) as $id) {
57
            $container->removeDefinition($id);
58
        }
59
        foreach (array_keys($container->findTaggedServiceIds('jms_serializer.subscribing_handler')) as $id) {
60
            $container->removeDefinition($id);
61
        }
62
63
        return $container;
64
    }
65
66
    public function testHandler()
67
    {

Tests/DependencyInjection/EventSubscribersAndListenersPassTest.php 1 location

@@ 37-66 (lines=30) @@
34
     * @param array $configs
35
     * @return ContainerBuilder
36
     */
37
    private function getContainer(array $configs = array())
38
    {
39
        $loader = new JMSSerializerExtension();
40
        $container = new ContainerBuilder();
41
42
        $container->getCompilerPassConfig()->setOptimizationPasses(array(
43
            new ResolveParameterPlaceHoldersPass(),
44
            new ResolveDefinitionTemplatesPass(),
45
        ));
46
        $container->getCompilerPassConfig()->setRemovingPasses(array(new RemoveUnusedDefinitionsPass()));
47
48
        $container->setParameter('kernel.debug', true);
49
        $container->setParameter('kernel.cache_dir', sys_get_temp_dir() . '/serializer');
50
        $container->setParameter('kernel.bundles', array());
51
        $container->setParameter('kernel.bundles', array());
52
53
        $loader->load(['jms_serializer' => $configs], $container);
54
55
56
        // remove other listeners
57
        foreach (array_keys($container->findTaggedServiceIds('jms_serializer.event_listener')) as $id) {
58
            $container->removeDefinition($id);
59
        }
60
        // remove other subscribers
61
        foreach (array_keys($container->findTaggedServiceIds('jms_serializer.event_subscriber')) as $id) {
62
            $container->removeDefinition($id);
63
        }
64
65
        return $container;
66
    }
67
68
    /**
69
     * @expectedException RuntimeException