|
@@ 15-29 (lines=15) @@
|
| 12 |
|
*/ |
| 13 |
|
final class CacheExceptionTest extends \PHPUnit_Framework_TestCase |
| 14 |
|
{ |
| 15 |
|
public function testFromNonClearableCache() |
| 16 |
|
{ |
| 17 |
|
/** @var DoctrineCache|\PHPUnit_Framework_MockObject_MockObject $doctrineCache */ |
| 18 |
|
$doctrineCache = $this->createMock(DoctrineCache::class); |
| 19 |
|
|
| 20 |
|
$exception = CacheException::fromNonClearableCache($doctrineCache); |
| 21 |
|
|
| 22 |
|
self::assertInstanceOf(CacheException::class, $exception); |
| 23 |
|
self::assertInstanceOf(PsrCacheException::class, $exception); |
| 24 |
|
|
| 25 |
|
self::assertStringMatchesFormat( |
| 26 |
|
'The given cache %s was not clearable, but you tried to use a feature that requires a clearable cache.', |
| 27 |
|
$exception->getMessage() |
| 28 |
|
); |
| 29 |
|
} |
| 30 |
|
|
| 31 |
|
public function testFromNonMultiGetCache() |
| 32 |
|
{ |
|
@@ 31-45 (lines=15) @@
|
| 28 |
|
); |
| 29 |
|
} |
| 30 |
|
|
| 31 |
|
public function testFromNonMultiGetCache() |
| 32 |
|
{ |
| 33 |
|
/** @var DoctrineCache|\PHPUnit_Framework_MockObject_MockObject $doctrineCache */ |
| 34 |
|
$doctrineCache = $this->createMock(DoctrineCache::class); |
| 35 |
|
|
| 36 |
|
$exception = CacheException::fromNonMultiGetCache($doctrineCache); |
| 37 |
|
|
| 38 |
|
self::assertInstanceOf(CacheException::class, $exception); |
| 39 |
|
self::assertInstanceOf(PsrCacheException::class, $exception); |
| 40 |
|
|
| 41 |
|
self::assertStringMatchesFormat( |
| 42 |
|
'The given cache %s cannot multi-get, but you tried to use a feature that requires a multi-get cache.', |
| 43 |
|
$exception->getMessage() |
| 44 |
|
); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
public function testFromNonMultiPutCache() |
| 48 |
|
{ |
|
@@ 47-61 (lines=15) @@
|
| 44 |
|
); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
public function testFromNonMultiPutCache() |
| 48 |
|
{ |
| 49 |
|
/** @var DoctrineCache|\PHPUnit_Framework_MockObject_MockObject $doctrineCache */ |
| 50 |
|
$doctrineCache = $this->createMock(DoctrineCache::class); |
| 51 |
|
|
| 52 |
|
$exception = CacheException::fromNonMultiPutCache($doctrineCache); |
| 53 |
|
|
| 54 |
|
self::assertInstanceOf(CacheException::class, $exception); |
| 55 |
|
self::assertInstanceOf(PsrCacheException::class, $exception); |
| 56 |
|
|
| 57 |
|
self::assertStringMatchesFormat( |
| 58 |
|
'The given cache %s cannot multi-put, but you tried to use a feature that requires a multi-put cache.', |
| 59 |
|
$exception->getMessage() |
| 60 |
|
); |
| 61 |
|
} |
| 62 |
|
} |
| 63 |
|
|