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

@@ 2902-2930 (lines=29) @@
2899
     *
2900
     * @see \eZ\Publish\API\Repository\SearchService::findContent()
2901
     */
2902
    public function testQueryModifiedField()
2903
    {
2904
        // Check using get_class since the others extend SetupFactory\Legacy
2905
        if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
2906
            $this->markTestIncomplete(
2907
                'Custom fields not supported by LegacySE ' .
2908
                '(@todo: Legacy should fallback to just querying normal field so this should be tested here)'
2909
            );
2910
        }
2911
2912
        $query = new Query(
2913
            array(
2914
                'query' => new Criterion\Field(
2915
                    'first_name',
2916
                    Criterion\Operator::EQ,
2917
                    'User'
2918
                ),
2919
                'offset' => 0,
2920
                'limit' => 10,
2921
                'sortClauses' => array(new SortClause\ContentId()),
2922
            )
2923
        );
2924
        $query->query->setCustomField('user', 'first_name', 'custom_field');
2925
2926
        $this->assertQueryFixture(
2927
            $query,
2928
            $this->getFixtureDir() . '/QueryModifiedField.php'
2929
        );
2930
    }
2931
2932
    /**
2933
     * Test for the findContent() method.