Code Duplication    Length = 29-31 lines in 2 locations

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

@@ 2719-2747 (lines=29) @@
2716
     *
2717
     * @see \eZ\Publish\API\Repository\SearchService::findContent()
2718
     */
2719
    public function testQueryModifiedField()
2720
    {
2721
        // Check using get_class since the others extend SetupFactory\Legacy
2722
        if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
2723
            $this->markTestIncomplete(
2724
                'Custom fields not supported by LegacySE ' .
2725
                '(@todo: Legacy should fallback to just querying normal field so this should be tested here)'
2726
            );
2727
        }
2728
2729
        $query = new Query(
2730
            [
2731
                'query' => new Criterion\Field(
2732
                    'first_name',
2733
                    Criterion\Operator::EQ,
2734
                    'User'
2735
                ),
2736
                'offset' => 0,
2737
                'limit' => 10,
2738
                'sortClauses' => [new SortClause\ContentId()],
2739
            ]
2740
        );
2741
        $query->query->setCustomField('user', 'first_name', 'custom_field');
2742
2743
        $this->assertQueryFixture(
2744
            $query,
2745
            $this->getFixtureDir() . '/QueryModifiedField.php'
2746
        );
2747
    }
2748
2749
    /**
2750
     * Test for the findContent() method.

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

@@ 501-531 (lines=31) @@
498
     *
499
     * @see \eZ\Publish\API\Repository\SearchService::findLocations()
500
     */
501
    public function testQueryModifiedField()
502
    {
503
        // Check using get_class since the others extend SetupFactory\Legacy
504
        if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
505
            $this->markTestIncomplete(
506
                'Custom fields not supported by LegacySE ' .
507
                '(@todo: Legacy should fallback to just querying normal field so this should be tested here)'
508
            );
509
        }
510
511
        $query = new LocationQuery(
512
            [
513
                'query' => new Criterion\Field(
514
                    'first_name',
515
                    Criterion\Operator::EQ,
516
                    'User'
517
                ),
518
                'offset' => 0,
519
                'limit' => 10,
520
                'sortClauses' => [new SortClause\ContentId()],
521
            ]
522
        );
523
        $query->query->setCustomField('user', 'first_name', 'custom_field');
524
525
        $this->assertQueryFixture(
526
            $query,
527
            $this->getFixtureDir() . '/QueryModifiedField.php',
528
            null,
529
            true
530
        );
531
    }
532
533
    /**
534
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType