Code Duplication    Length = 8-10 lines in 9 locations

eZ/Publish/API/Repository/Tests/FieldType/SearchMultivaluedBaseIntegrationTest.php 7 locations

@@ 222-231 (lines=10) @@
219
     * @dataProvider findMultivaluedProvider
220
     * @depends testCreateMultivaluedTestContent
221
     */
222
    public function testFindMultivaluedEqualsOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context)
223
    {
224
        $this->checkOperatorSupport(Operator::EQ);
225
226
        foreach ($valuesOne as $value) {
227
            $criteria = new Field('data', Operator::EQ, $value);
228
229
            $this->assertFindResult($context, $criteria, true, false, $filter, $content, $modifyField);
230
        }
231
    }
232
233
    /**
234
     * Tests search with EQ operator.
@@ 268-275 (lines=8) @@
265
     * @dataProvider findMultivaluedProvider
266
     * @depends testCreateMultivaluedTestContent
267
     */
268
    public function testFindMultivaluedInOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context)
269
    {
270
        $this->checkOperatorSupport(Operator::IN);
271
272
        $criteria = new Field('data', Operator::IN, $valuesOne);
273
274
        $this->assertFindResult($context, $criteria, true, false, $filter, $content, $modifyField);
275
    }
276
277
    /**
278
     * Tests search with IN operator.
@@ 356-365 (lines=10) @@
353
     * @dataProvider findMultivaluedProvider
354
     * @depends testCreateMultivaluedTestContent
355
     */
356
    public function testFindMultivaluedContainsOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context)
357
    {
358
        $this->checkOperatorSupport(Operator::CONTAINS);
359
360
        foreach ($valuesOne as $value) {
361
            $criteria = new Field('data', Operator::CONTAINS, $value);
362
363
            $this->assertFindResult($context, $criteria, true, false, $filter, $content, $modifyField);
364
        }
365
    }
366
367
    /**
368
     * Tests search with CONTAINS operator.
@@ 423-430 (lines=8) @@
420
     * @dataProvider findMultivaluedProvider
421
     * @depends testCreateMultivaluedTestContent
422
     */
423
    public function testFindMultivaluedGreaterThanOneFindsTwo($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context)
424
    {
425
        $this->checkOperatorSupport(Operator::GT);
426
427
        $criteria = new Field('data', Operator::GT, end($valuesOne));
428
429
        $this->assertFindResult($context, $criteria, false, true, $filter, $content, $modifyField);
430
    }
431
432
    /**
433
     * Tests search with GT operator.
@@ 486-495 (lines=10) @@
483
     * @dataProvider findMultivaluedProvider
484
     * @depends testCreateMultivaluedTestContent
485
     */
486
    public function testFindMultivaluedGreaterThanOrEqualOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context)
487
    {
488
        $this->checkOperatorSupport(Operator::GTE);
489
490
        foreach ($valuesOne as $value) {
491
            $criteria = new Field('data', Operator::GTE, $value);
492
493
            $this->assertFindResult($context, $criteria, true, true, $filter, $content, $modifyField);
494
        }
495
    }
496
497
    /**
498
     * Tests search with GTE operator.
@@ 553-560 (lines=8) @@
550
     * @dataProvider findMultivaluedProvider
551
     * @depends testCreateMultivaluedTestContent
552
     */
553
    public function testFindMultivaluedLowerThanOneFindsOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context)
554
    {
555
        $this->checkOperatorSupport(Operator::LT);
556
557
        $criteria = new Field('data', Operator::LT, end($valuesOne));
558
559
        $this->assertFindResult($context, $criteria, true, false, $filter, $content, $modifyField);
560
    }
561
562
    /**
563
     * Tests search with LT operator.
@@ 616-625 (lines=10) @@
613
     * @dataProvider findMultivaluedProvider
614
     * @depends testCreateMultivaluedTestContent
615
     */
616
    public function testFindMultivaluedLowerThanOrEqualOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context)
617
    {
618
        $this->checkOperatorSupport(Operator::LTE);
619
620
        foreach ($valuesOne as $value) {
621
            $criteria = new Field('data', Operator::LTE, $value);
622
623
            $this->assertFindResult($context, $criteria, true, false, $filter, $content, $modifyField);
624
        }
625
    }
626
627
    /**
628
     * Tests search with LTE operator.

eZ/Publish/API/Repository/Tests/FieldType/SearchBaseIntegrationTest.php 2 locations

@@ 1055-1062 (lines=8) @@
1052
     * @dataProvider findProvider
1053
     * @depends testCreateTestContent
1054
     */
1055
    public function testFindNotContainsTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context)
1056
    {
1057
        $criteria = new LogicalNot(
1058
            new Field('data', Operator::CONTAINS, $valueTwo)
1059
        );
1060
1061
        $this->assertFindResult($context, $criteria, true, false, $filter, $content, $modifyField);
1062
    }
1063
1064
    /**
1065
     * Tests search with LIKE operator, with NO wildcard.
@@ 1070-1078 (lines=9) @@
1067
     * @dataProvider findProvider
1068
     * @depends testCreateTestContent
1069
     */
1070
    public function testFindLikeOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context)
1071
    {
1072
        // (in case test is skipped for current search engine)
1073
        $this->supportsLikeWildcard($valueOne);
1074
1075
        $criteria = new Field('data', Operator::LIKE, $valueOne);
1076
1077
        $this->assertFindResult($context, $criteria, true, false, $filter, $content, $modifyField);
1078
    }
1079
1080
    /**
1081
     * Tests search with LIKE operator, with wildcard at the end (on strings).