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

@@ 2657-2685 (lines=29) @@
2654
     *
2655
     * @see \eZ\Publish\API\Repository\SearchService::findContent()
2656
     */
2657
    public function testQueryModifiedField()
2658
    {
2659
        // Check using get_class since the others extend SetupFactory\Legacy
2660
        if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
2661
            $this->markTestIncomplete(
2662
                'Custom fields not supported by LegacySE ' .
2663
                '(@todo: Legacy should fallback to just querying normal field so this should be tested here)'
2664
            );
2665
        }
2666
2667
        $query = new Query(
2668
            array(
2669
                'query' => new Criterion\Field(
2670
                    'first_name',
2671
                    Criterion\Operator::EQ,
2672
                    'User'
2673
                ),
2674
                'offset' => 0,
2675
                'limit' => 10,
2676
                'sortClauses' => array(new SortClause\ContentId()),
2677
            )
2678
        );
2679
        $query->query->setCustomField('user', 'first_name', 'custom_field');
2680
2681
        $this->assertQueryFixture(
2682
            $query,
2683
            $this->getFixtureDir() . '/QueryModifiedField.php'
2684
        );
2685
    }
2686
2687
    /**
2688
     * Test for the findContent() method.