Code Duplication    Length = 29-31 lines in 2 locations

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

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

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

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