Code Duplication    Length = 29-30 lines in 3 locations

eZ/Bundle/EzPublishCoreBundle/Features/Context/QueryControllerContext.php 3 locations

@@ 52-81 (lines=30) @@
49
    /**
50
     * @Given /^the following content view configuration block:$/
51
     */
52
    public function addContentViewConfigurationBlock(PyStringNode $string)
53
    {
54
        $configurationBlock = array_merge(
55
            Yaml::parse($string),
56
            [
57
                'template' => '@eZBehat/tests/dump.html.twig',
58
                'match' => [
59
                    'Id\Content' => $this->matchedContent->id,
60
                ],
61
            ]
62
        );
63
64
        $configurationBlockName = 'behat_query_controller_' . $this->matchedContent->id;
65
66
        $configuration = [
67
            'ezpublish' => [
68
                'system' => [
69
                    'default' => [
70
                        'content_view' => [
71
                            'full' => [
72
                                $configurationBlockName => $configurationBlock,
73
                            ],
74
                        ],
75
                    ],
76
                ],
77
            ],
78
        ];
79
80
        $this->configurationContext->addConfiguration($configuration);
81
    }
82
83
    /**
84
     * @Given /^the following content view configuration block with paging action:$/
@@ 86-115 (lines=30) @@
83
    /**
84
     * @Given /^the following content view configuration block with paging action:$/
85
     */
86
    public function addContentViewConfigurationBlockWithPagingAction(PyStringNode $string)
87
    {
88
        $configurationBlock = array_merge(
89
            Yaml::parse($string),
90
            [
91
                'template' => '@eZBehat/tests/dump.html.twig',
92
                'match' => [
93
                    'Id\Content' => $this->matchedContent->id,
94
                ],
95
            ]
96
        );
97
98
        $configurationBlockName = 'behat_paging_query_controller_' . $this->matchedContent->id;
99
100
        $configuration = [
101
            'ezpublish' => [
102
                'system' => [
103
                    'default' => [
104
                        'content_view' => [
105
                            'full' => [
106
                                $configurationBlockName => $configurationBlock,
107
                            ],
108
                        ],
109
                    ],
110
                ],
111
            ],
112
        ];
113
114
        $this->configurationContext->addConfiguration($configuration);
115
    }
116
117
    /**
118
     * @Given /^a content item that matches the view configuration block below$/
@@ 310-338 (lines=29) @@
307
    /**
308
     * @Given the following content view configuration block with paging action and the template set above:
309
     */
310
    public function theFollowingContentViewConfigurationBlockWithPagingActionAndTheTemplateSetAbove(PyStringNode $string)
311
    {
312
        $configurationBlock = array_merge(
313
            Yaml::parse($string),
314
            [
315
                'match' => [
316
                    'Id\Content' => $this->matchedContent->id,
317
                ],
318
            ]
319
        );
320
321
        $configurationBlockName = 'behat_paging_query_controller_' . $this->matchedContent->id;
322
323
        $configuration = [
324
            'ezpublish' => [
325
                'system' => [
326
                    'default' => [
327
                        'content_view' => [
328
                            'full' => [
329
                                $configurationBlockName => $configurationBlock,
330
                            ],
331
                        ],
332
                    ],
333
                ],
334
            ],
335
        ];
336
337
        $this->configurationContext->addConfiguration($configuration);
338
    }
339
340
    /**
341
     * @When I view a content matched by the view configuration above on page :arg1 with the :arg2 parameter