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