Code Duplication    Length = 29-31 lines in 2 locations

eZ/Publish/API/Repository/Tests/SearchServiceLocationTest.php 1 location

@@ 262-292 (lines=31) @@
259
     *
260
     * @see \eZ\Publish\API\Repository\SearchService::findLocations()
261
     */
262
    public function testQueryModifiedField()
263
    {
264
        // Check using get_class since the others extend SetupFactory\Legacy
265
        if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
266
            $this->markTestIncomplete(
267
                'Custom fields not supported by LegacySE ' .
268
                '(@todo: Legacy should fallback to just querying normal field so this should be tested here)'
269
            );
270
        }
271
272
        $query = new LocationQuery(
273
            [
274
                'query' => new Criterion\Field(
275
                    'first_name',
276
                    Criterion\Operator::EQ,
277
                    'User'
278
                ),
279
                'offset' => 0,
280
                'limit' => 10,
281
                'sortClauses' => [new SortClause\ContentId()],
282
            ]
283
        );
284
        $query->query->setCustomField('user', 'first_name', 'custom_field');
285
286
        $this->assertQueryFixture(
287
            $query,
288
            $this->getFixtureDir() . '/QueryModifiedField.php',
289
            null,
290
            true
291
        );
292
    }
293
294
    /**
295
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType

eZ/Publish/API/Repository/Tests/SearchServiceTest.php 1 location

@@ 2783-2811 (lines=29) @@
2780
     *
2781
     * @see \eZ\Publish\API\Repository\SearchService::findContent()
2782
     */
2783
    public function testQueryModifiedField()
2784
    {
2785
        // Check using get_class since the others extend SetupFactory\Legacy
2786
        if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
2787
            $this->markTestIncomplete(
2788
                'Custom fields not supported by LegacySE ' .
2789
                '(@todo: Legacy should fallback to just querying normal field so this should be tested here)'
2790
            );
2791
        }
2792
2793
        $query = new Query(
2794
            [
2795
                'query' => new Criterion\Field(
2796
                    'first_name',
2797
                    Criterion\Operator::EQ,
2798
                    'User'
2799
                ),
2800
                'offset' => 0,
2801
                'limit' => 10,
2802
                'sortClauses' => [new SortClause\ContentId()],
2803
            ]
2804
        );
2805
        $query->query->setCustomField('user', 'first_name', 'custom_field');
2806
2807
        $this->assertQueryFixture(
2808
            $query,
2809
            $this->getFixtureDir() . '/QueryModifiedField.php'
2810
        );
2811
    }
2812
2813
    /**
2814
     * Test for the findContent() method.