Code Duplication    Length = 23-25 lines in 3 locations

tests/Aggregation/DerivativeTest.php 1 location

@@ 19-41 (lines=23) @@
16
    /**
17
     * @group unit
18
     */
19
    public function testToArray(): void
20
    {
21
        $expected = [
22
            'max' => [
23
                'field' => 'value',
24
            ],
25
            'aggs' => [
26
                'derivative_agg' => [
27
                    'derivative' => [
28
                        'buckets_path' => 'max_agg',
29
                    ],
30
                ],
31
            ],
32
        ];
33
34
        $maxAgg = new Max('max_agg');
35
        $maxAgg->setField('value');
36
37
        $deriveAgg = new Derivative('derivative_agg', 'max_agg');
38
        $maxAgg->addAggregation($deriveAgg);
39
40
        $this->assertEquals($expected, $maxAgg->toArray());
41
    }
42
43
    /**
44
     * @group functional

tests/Aggregation/SamplerTest.php 1 location

@@ 19-43 (lines=25) @@
16
    /**
17
     * @group unit
18
     */
19
    public function testToArray(): void
20
    {
21
        $expected = [
22
            'sampler' => [
23
                'shard_size' => 1,
24
            ],
25
            'aggs' => [
26
                'price_sum' => [
27
                    'sum' => [
28
                        'field' => 'price',
29
                    ],
30
                ],
31
            ],
32
        ];
33
34
        $agg = new Sampler('price_sampler');
35
        $agg->setShardSize(1);
36
37
        $childAgg = new Sum('price_sum');
38
        $childAgg->setField('price');
39
40
        $agg->addAggregation($childAgg);
41
42
        $this->assertEquals($expected, $agg->toArray());
43
    }
44
45
    /**
46
     * @dataProvider shardSizeProvider

tests/Processor/ForeachProcessorTest.php 1 location

@@ 45-69 (lines=25) @@
42
    /**
43
     * @group unit
44
     */
45
    public function testForeachRawProcessorDefault(): void
46
    {
47
        $processor = new ForeachProcessor();
48
        $processor->setField('field1');
49
50
        $subprocessor = [
51
            'uppercase' => [
52
                'field' => 'field2',
53
            ],
54
        ];
55
        $processor->setRawProcessor($subprocessor);
56
57
        $expected = [
58
            'foreach' => [
59
                'field' => 'field1',
60
                'processor' => [
61
                    'uppercase' => [
62
                        'field' => 'field2',
63
                    ],
64
                ],
65
            ],
66
        ];
67
68
        $this->assertEquals($expected, $processor->toArray());
69
    }
70
71
    /**
72
     * @group unit