Code Duplication    Length = 29-31 lines in 2 locations

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

@@ 262-292 (lines=31) @@
259
     *
260
     * @see \eZ\Publish\API\Repository\SearchService::findLocations()
261
     */
262
    public function testQueryModifiedField()
263
    {
264
        // Check using get_class since the others extend SetupFactory\Legacy
265
        if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
266
            $this->markTestIncomplete(
267
                'Custom fields not supported by LegacySE ' .
268
                '(@todo: Legacy should fallback to just querying normal field so this should be tested here)'
269
            );
270
        }
271
272
        $query = new LocationQuery(
273
            array(
274
                'query' => new Criterion\Field(
275
                    'first_name',
276
                    Criterion\Operator::EQ,
277
                    'User'
278
                ),
279
                'offset' => 0,
280
                'limit' => 10,
281
                'sortClauses' => array(new SortClause\ContentId()),
282
            )
283
        );
284
        $query->query->setCustomField('user', 'first_name', 'custom_field');
285
286
        $this->assertQueryFixture(
287
            $query,
288
            $this->getFixtureDir() . '/QueryModifiedField.php',
289
            null,
290
            true
291
        );
292
    }
293
294
    /**
295
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType

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

@@ 2836-2864 (lines=29) @@
2833
     *
2834
     * @see \eZ\Publish\API\Repository\SearchService::findContent()
2835
     */
2836
    public function testQueryModifiedField()
2837
    {
2838
        // Check using get_class since the others extend SetupFactory\Legacy
2839
        if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy') {
2840
            $this->markTestIncomplete(
2841
                'Custom fields not supported by LegacySE ' .
2842
                '(@todo: Legacy should fallback to just querying normal field so this should be tested here)'
2843
            );
2844
        }
2845
2846
        $query = new Query(
2847
            array(
2848
                'query' => new Criterion\Field(
2849
                    'first_name',
2850
                    Criterion\Operator::EQ,
2851
                    'User'
2852
                ),
2853
                'offset' => 0,
2854
                'limit' => 10,
2855
                'sortClauses' => array(new SortClause\ContentId()),
2856
            )
2857
        );
2858
        $query->query->setCustomField('user', 'first_name', 'custom_field');
2859
2860
        $this->assertQueryFixture(
2861
            $query,
2862
            $this->getFixtureDir() . '/QueryModifiedField.php'
2863
        );
2864
    }
2865
2866
    /**
2867
     * Test for the findContent() method.