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
            array(
274
                'query' => new Criterion\Field(
275
                    'first_name',
276
                    Criterion\Operator::EQ,
277
                    'User'
278
                ),
279
                'offset' => 0,
280
                'limit' => 10,
281
                'sortClauses' => array(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

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