|
@@ 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 testFromNonMultiOperationCache() |
| 32 |
|
{ |
|
@@ 31-46 (lines=16) @@
|
| 28 |
|
); |
| 29 |
|
} |
| 30 |
|
|
| 31 |
|
public function testFromNonMultiOperationCache() |
| 32 |
|
{ |
| 33 |
|
/** @var DoctrineCache|\PHPUnit_Framework_MockObject_MockObject $doctrineCache */ |
| 34 |
|
$doctrineCache = $this->createMock(DoctrineCache::class); |
| 35 |
|
|
| 36 |
|
$exception = CacheException::fromNonMultiOperationCache($doctrineCache); |
| 37 |
|
|
| 38 |
|
self::assertInstanceOf(CacheException::class, $exception); |
| 39 |
|
self::assertInstanceOf(PsrCacheException::class, $exception); |
| 40 |
|
|
| 41 |
|
self::assertStringMatchesFormat( |
| 42 |
|
'The given cache %s does not support multiple operations, ' |
| 43 |
|
. 'but you tried to use a feature that requires a multi-operation cache.', |
| 44 |
|
$exception->getMessage() |
| 45 |
|
); |
| 46 |
|
} |
| 47 |
|
} |
| 48 |
|
|