Skip to content

Commit c93bd7d

Browse files
authored
Merge pull request #806 from Geolim4/master
Released 8.0.6
2 parents 3f5c165 + 8223b97 commit c93bd7d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 8.0.6
2+
#### _"Re-deconfined"_
3+
##### 07 july 2021
4+
- __Helpers__
5+
- Allow $cacheItem to be retrieved by callback argument in CacheConditionalHelper (@geolim4)
6+
17
## 8.0.5
28
#### _"Re-re-confined"_
39
##### 05 april 2021

tests/CacheConditional.test.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
use Phpfastcache\CacheManager;
9+
use Phpfastcache\Core\Item\ExtendedCacheItemInterface;
910
use Phpfastcache\Helper\CacheConditionalHelper as CacheConditional;
1011
use Phpfastcache\Helper\TestHelper;
1112
use Psr\Cache\CacheItemPoolInterface;
@@ -22,7 +23,12 @@
2223
/**
2324
* Missing cache item test
2425
*/
25-
$cacheValue = (new CacheConditional($cacheInstance))->get($cacheKey, function() use ($cacheKey, $testHelper, $RandomCacheValue){
26+
$cacheValue = (new CacheConditional($cacheInstance))->get($cacheKey, static function() use ($cacheKey, $testHelper, $RandomCacheValue){
27+
if(func_get_arg(0) instanceof ExtendedCacheItemInterface){
28+
$testHelper->printPassText('The callback has been received the cache item as a parameter (introduced in 8.0.6).');
29+
}else{
30+
$testHelper->printFailText('The callback has not received the cache item as a parameter (introduced in 8.0.6).');
31+
}
2632
/**
2733
* No parameter are passed
2834
* to this closure
@@ -98,4 +104,4 @@
98104
}
99105

100106
$cacheInstance->clear();
101-
$testHelper->terminateTest();
107+
$testHelper->terminateTest();

0 commit comments

Comments
 (0)