Skip to content

Commit 1bffce3

Browse files
committed
Use correct exception named constructor when creating SimpleCacheAdapter with a non-Clearable cache
1 parent 431f119 commit 1bffce3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/SimpleCacheAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct(DoctrineCache $doctrineCache)
2525
$this->doctrineCache = $doctrineCache;
2626

2727
if (!$this->doctrineCache instanceof ClearableCache) {
28-
throw Exception\CacheException::fromNonMultiOperationCache($this->doctrineCache);
28+
throw Exception\CacheException::fromNonClearableCache($this->doctrineCache);
2929
}
3030

3131
if (!$this->doctrineCache instanceof MultiOperationCache) {

test/unit/SimpleCacheAdapterTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public function testConstructorThrowsExceptionWhenNotMultiOperationCacheIsUsed()
7171
$doctrineCache = $this->createMock(NotMultiOperationCache::class);
7272

7373
$this->expectException(CacheException::class);
74+
$this->expectExceptionMessage('not support multiple operations');
7475
new SimpleCacheAdapter($doctrineCache);
7576
}
7677

@@ -80,6 +81,7 @@ public function testConstructorThrowsExceptionWhenNotClearableCacheIsUsed()
8081
$doctrineCache = $this->createMock(NotClearableCache::class);
8182

8283
$this->expectException(CacheException::class);
84+
$this->expectExceptionMessage('not clearable');
8385
new SimpleCacheAdapter($doctrineCache);
8486
}
8587

0 commit comments

Comments
 (0)