Code Duplication    Length = 29-31 lines in 2 locations

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

@@ 277-307 (lines=31) @@
274
     *
275
     * @see \eZ\Publish\API\Repository\SearchService::findLocations()
276
     */
277
    public function testQueryModifiedField()
278
    {
279
        // Check using get_class since the others extend SetupFactory\Legacy
280
        if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
281
            $this->markTestIncomplete(
282
                'Custom fields not supported by LegacySE ' .
283
                '(@todo: Legacy should fallback to just querying normal field so this should be tested here)'
284
            );
285
        }
286
287
        $query = new LocationQuery(
288
            [
289
                'query' => new Criterion\Field(
290
                    'first_name',
291
                    Criterion\Operator::EQ,
292
                    'User'
293
                ),
294
                'offset' => 0,
295
                'limit' => 10,
296
                'sortClauses' => [new SortClause\ContentId()],
297
            ]
298
        );
299
        $query->query->setCustomField('user', 'first_name', 'custom_field');
300
301
        $this->assertQueryFixture(
302
            $query,
303
            $this->getFixtureDir() . '/QueryModifiedField.php',
304
            null,
305
            true
306
        );
307
    }
308
309
    /**
310
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType

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

@@ 2685-2713 (lines=29) @@
2682
     *
2683
     * @see \eZ\Publish\API\Repository\SearchService::findContent()
2684
     */
2685
    public function testQueryModifiedField()
2686
    {
2687
        // Check using get_class since the others extend SetupFactory\Legacy
2688
        if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
2689
            $this->markTestIncomplete(
2690
                'Custom fields not supported by LegacySE ' .
2691
                '(@todo: Legacy should fallback to just querying normal field so this should be tested here)'
2692
            );
2693
        }
2694
2695
        $query = new Query(
2696
            [
2697
                'query' => new Criterion\Field(
2698
                    'first_name',
2699
                    Criterion\Operator::EQ,
2700
                    'User'
2701
                ),
2702
                'offset' => 0,
2703
                'limit' => 10,
2704
                'sortClauses' => [new SortClause\ContentId()],
2705
            ]
2706
        );
2707
        $query->query->setCustomField('user', 'first_name', 'custom_field');
2708
2709
        $this->assertQueryFixture(
2710
            $query,
2711
            $this->getFixtureDir() . '/QueryModifiedField.php'
2712
        );
2713
    }
2714
2715
    /**
2716
     * Test for the findContent() method.