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

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