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

@@ 2549-2577 (lines=29) @@
2546
     *
2547
     * @see \eZ\Publish\API\Repository\SearchService::findContent()
2548
     */
2549
    public function testQueryModifiedField()
2550
    {
2551
        // Check using get_class since the others extend SetupFactory\Legacy
2552
        if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
2553
            $this->markTestIncomplete(
2554
                'Custom fields not supported by LegacySE ' .
2555
                '(@todo: Legacy should fallback to just querying normal field so this should be tested here)'
2556
            );
2557
        }
2558
2559
        $query = new Query(
2560
            [
2561
                'query' => new Criterion\Field(
2562
                    'first_name',
2563
                    Criterion\Operator::EQ,
2564
                    'User'
2565
                ),
2566
                'offset' => 0,
2567
                'limit' => 10,
2568
                'sortClauses' => [new SortClause\ContentId()],
2569
            ]
2570
        );
2571
        $query->query->setCustomField('user', 'first_name', 'custom_field');
2572
2573
        $this->assertQueryFixture(
2574
            $query,
2575
            $this->getFixtureDir() . '/QueryModifiedField.php'
2576
        );
2577
    }
2578
2579
    /**
2580
     * Test for the findContent() method.