Code Duplication    Length = 22-24 lines in 2 locations

Tests/DependencyInjection/CustomHandlerPassTest.php 1 location

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

Tests/DependencyInjection/EventSubscribersAndListenersPassTest.php 1 location

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