Code Duplication    Length = 29-31 lines in 2 locations

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

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

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

@@ 2767-2795 (lines=29) @@
2764
     *
2765
     * @see \eZ\Publish\API\Repository\SearchService::findContent()
2766
     */
2767
    public function testQueryModifiedField()
2768
    {
2769
        // Check using get_class since the others extend SetupFactory\Legacy
2770
        if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
2771
            $this->markTestIncomplete(
2772
                'Custom fields not supported by LegacySE ' .
2773
                '(@todo: Legacy should fallback to just querying normal field so this should be tested here)'
2774
            );
2775
        }
2776
2777
        $query = new Query(
2778
            array(
2779
                'query' => new Criterion\Field(
2780
                    'first_name',
2781
                    Criterion\Operator::EQ,
2782
                    'User'
2783
                ),
2784
                'offset' => 0,
2785
                'limit' => 10,
2786
                'sortClauses' => array(new SortClause\ContentId()),
2787
            )
2788
        );
2789
        $query->query->setCustomField('user', 'first_name', 'custom_field');
2790
2791
        $this->assertQueryFixture(
2792
            $query,
2793
            $this->getFixtureDir() . '/QueryModifiedField.php'
2794
        );
2795
    }
2796
2797
    /**
2798
     * Test for the findContent() method.