Code Duplication    Length = 11-14 lines in 4 locations

test/unit/Exception/InvalidArgumentExceptionTest.php 4 locations

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