Code Duplication    Length = 29-31 lines in 2 locations

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

@@ 417-447 (lines=31) @@
414
     *
415
     * @see \eZ\Publish\API\Repository\SearchService::findLocations()
416
     */
417
    public function testQueryModifiedField()
418
    {
419
        // Check using get_class since the others extend SetupFactory\Legacy
420
        if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
421
            $this->markTestIncomplete(
422
                'Custom fields not supported by LegacySE ' .
423
                '(@todo: Legacy should fallback to just querying normal field so this should be tested here)'
424
            );
425
        }
426
427
        $query = new LocationQuery(
428
            [
429
                'query' => new Criterion\Field(
430
                    'first_name',
431
                    Criterion\Operator::EQ,
432
                    'User'
433
                ),
434
                'offset' => 0,
435
                'limit' => 10,
436
                'sortClauses' => [new SortClause\ContentId()],
437
            ]
438
        );
439
        $query->query->setCustomField('user', 'first_name', 'custom_field');
440
441
        $this->assertQueryFixture(
442
            $query,
443
            $this->getFixtureDir() . '/QueryModifiedField.php',
444
            null,
445
            true
446
        );
447
    }
448
449
    /**
450
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType

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

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