@@ 13-24 (lines=12) @@ | ||
10 | */ |
|
11 | final class InvalidArgumentExceptionTest extends \PHPUnit_Framework_TestCase |
|
12 | { |
|
13 | public function testFromKeyAndInvalidTTLObject() |
|
14 | { |
|
15 | $invalidTTL = new \stdClass(); |
|
16 | $exception = InvalidArgumentException::fromKeyAndInvalidTTL('key', $invalidTTL); |
|
17 | self::assertInstanceOf(InvalidArgumentException::class, $exception); |
|
18 | self::assertInstanceOf(\Psr\SimpleCache\InvalidArgumentException::class, $exception); |
|
19 | ||
20 | self::assertStringMatchesFormat( |
|
21 | 'TTL for "%s" should be defined by an integer or a DateInterval, but stdClass is given.', |
|
22 | $exception->getMessage() |
|
23 | ); |
|
24 | } |
|
25 | ||
26 | public function testFromKeyAndInvalidTTLNonObject() |
|
27 | { |
|
@@ 26-37 (lines=12) @@ | ||
23 | ); |
|
24 | } |
|
25 | ||
26 | public function testFromKeyAndInvalidTTLNonObject() |
|
27 | { |
|
28 | $invalidTTL = random_int(100, 200); |
|
29 | $exception = InvalidArgumentException::fromKeyAndInvalidTTL('key', $invalidTTL); |
|
30 | self::assertInstanceOf(InvalidArgumentException::class, $exception); |
|
31 | self::assertInstanceOf(\Psr\SimpleCache\InvalidArgumentException::class, $exception); |
|
32 | ||
33 | self::assertStringMatchesFormat( |
|
34 | 'TTL for "%s" should be defined by an integer or a DateInterval, but integer is given.', |
|
35 | $exception->getMessage() |
|
36 | ); |
|
37 | } |
|
38 | } |
|
39 |