Code Duplication    Length = 12-12 lines in 2 locations

test/unit/Exception/InvalidArgumentExceptionTest.php 2 locations

@@ 15-26 (lines=12) @@
12
 */
13
final class InvalidArgumentExceptionTest extends TestCase
14
{
15
    public function testFromKeyAndInvalidTTLObject()
16
    {
17
        $invalidTTL = new \stdClass();
18
        $exception = InvalidArgumentException::fromKeyAndInvalidTTL('key', $invalidTTL);
19
        self::assertInstanceOf(InvalidArgumentException::class, $exception);
20
        self::assertInstanceOf(PsrInvalidArgumentException::class, $exception);
21
22
        self::assertStringMatchesFormat(
23
            'TTL for "%s" should be defined by an integer or a DateInterval, but stdClass is given.',
24
            $exception->getMessage()
25
        );
26
    }
27
    public function testFromInvalidKeyCharacters()
28
    {
29
        $invalidKey = uniqid('invalidKey', true);
@@ 65-76 (lines=12) @@
62
        );
63
    }
64
65
    public function testFromKeyAndInvalidTTLNonObject()
66
    {
67
        $invalidTTL = random_int(100, 200);
68
        $exception = InvalidArgumentException::fromKeyAndInvalidTTL('key', $invalidTTL);
69
        self::assertInstanceOf(InvalidArgumentException::class, $exception);
70
        self::assertInstanceOf(\Psr\SimpleCache\InvalidArgumentException::class, $exception);
71
72
        self::assertStringMatchesFormat(
73
            'TTL for "%s" should be defined by an integer or a DateInterval, but integer is given.',
74
            $exception->getMessage()
75
        );
76
    }
77
78
    public function testFromNonIterableKeys()
79
    {