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
            array(
289
                'query' => new Criterion\Field(
290
                    'first_name',
291
                    Criterion\Operator::EQ,
292
                    'User'
293
                ),
294
                'offset' => 0,
295
                'limit' => 10,
296
                'sortClauses' => array(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

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