Code Duplication    Length = 10-17 lines in 2 locations

tests/FiltererTest.php 2 locations

@@ 532-548 (lines=17) @@
529
     * @test
530
     * @covers ::ofScalars
531
     */
532
    public function ofScalarsFail()
533
    {
534
        try {
535
            Filterer::ofScalars(['1', [], new stdClass], [['string']]);
536
            $this->fail();
537
        } catch (FilterException $e) {
538
            $expected = <<<TXT
539
Field '1' with value 'array (
540
)' failed filtering, message 'Value 'array (
541
)' is not a string'
542
Field '2' with value 'stdClass::__set_state(array(
543
))' failed filtering, message 'Value 'stdClass::__set_state(array(
544
))' is not a string'
545
TXT;
546
            $this->assertSame($expected, $e->getMessage());
547
        }
548
    }
549
550
    /**
551
     * @test
@@ 665-674 (lines=10) @@
662
     * @test
663
     * @covers ::ofArray
664
     */
665
    public function ofArrayUnknown()
666
    {
667
        try {
668
            Filterer::ofArray(['key' => '1'], ['key2' => [['uint']]]);
669
            $this->fail();
670
        } catch (FilterException $e) {
671
            $expected = "Field 'key' with value '1' is unknown";
672
            $this->assertSame($expected, $e->getMessage());
673
        }
674
    }
675
676
    /**
677
     * @test