Code Duplication    Length = 11-14 lines in 4 locations

test/unit/Exception/InvalidArgumentExceptionTest.php 4 locations

@@ 27-40 (lines=14) @@
24
            $exception->getMessage()
25
        );
26
    }
27
    public function testFromInvalidKeyCharacters()
28
    {
29
        $invalidKey = uniqid('invalidKey', true);
30
        $exception = InvalidArgumentException::fromInvalidKeyCharacters($invalidKey);
31
        self::assertInstanceOf(InvalidArgumentException::class, $exception);
32
        self::assertInstanceOf(PsrInvalidArgumentException::class, $exception);
33
        self::assertSame(
34
            sprintf(
35
                'Key "%s" is in an invalid format - must not contain characters: {}()/\@:',
36
                $invalidKey
37
            ),
38
            $exception->getMessage()
39
        );
40
    }
41
42
    public function testFromInvalidType()
43
    {
@@ 42-52 (lines=11) @@
39
        );
40
    }
41
42
    public function testFromInvalidType()
43
    {
44
        $invalidKey = random_int(100, 200);
45
        $exception = InvalidArgumentException::fromInvalidType($invalidKey);
46
        self::assertInstanceOf(InvalidArgumentException::class, $exception);
47
        self::assertInstanceOf(PsrInvalidArgumentException::class, $exception);
48
        self::assertSame(
49
            'Key was not a valid type. Expected string, received integer',
50
            $exception->getMessage()
51
        );
52
    }
53
54
    public function testFromEmptyKey()
55
    {
@@ 78-88 (lines=11) @@
75
        );
76
    }
77
78
    public function testFromNonIterableKeys()
79
    {
80
        $invalidKey = random_int(100, 200);
81
        $exception = InvalidArgumentException::fromNonIterableKeys($invalidKey);
82
        self::assertInstanceOf(InvalidArgumentException::class, $exception);
83
        self::assertInstanceOf(PsrInvalidArgumentException::class, $exception);
84
        self::assertSame(
85
            'Keys passed were not iterable (i.e. \Traversable or array), received: integer',
86
            $exception->getMessage()
87
        );
88
    }
89
90
    public function testFromNonIterableValues()
91
    {
@@ 90-100 (lines=11) @@
87
        );
88
    }
89
90
    public function testFromNonIterableValues()
91
    {
92
        $invalidValue = random_int(100, 200);
93
        $exception = InvalidArgumentException::fromNonIterableValues($invalidValue);
94
        self::assertInstanceOf(InvalidArgumentException::class, $exception);
95
        self::assertInstanceOf(PsrInvalidArgumentException::class, $exception);
96
        self::assertSame(
97
            'Values passed were not iterable (i.e. \Traversable or array), received: integer',
98
            $exception->getMessage()
99
        );
100
    }
101
}
102