1919use Codeception \Test \Unit ;
2020use Pimcore \Bundle \GenericDataIndexBundle \SearchIndexAdapter \SearchIndexServiceInterface ;
2121use Pimcore \Bundle \GenericDataIndexBundle \Service \SearchIndex \CachedSearchIndexMappingService ;
22+ use Pimcore \Bundle \StaticResolverBundle \Contract \Lib \Cache \RuntimeCacheResolverContract ;
2223use Pimcore \Bundle \StaticResolverBundle \Lib \Cache \RuntimeCacheResolverInterface ;
2324
2425/**
@@ -30,37 +31,13 @@ final class CachedSearchIndexMappingServiceTest extends Unit
3031
3132 public function _before (): void
3233 {
33- $ runtimeCacheResolver = new class implements RuntimeCacheResolverInterface {
34- private ?array $ cacheEntry = null ;
35-
36- public function load (string $ id ): mixed
37- {
38- return $ this ->cacheEntry ;
39- }
40-
41- public function save (mixed $ data , string $ id ): void
42- {
43- $ this ->cacheEntry = $ data ;
44- }
45-
46- public function isRegistered (string $ index ): bool
47- {
48- return is_array ($ this ->cacheEntry );
49- }
50-
51- public function clear (array $ keepItems = []): void
52- {
53- $ this ->cacheEntry = null ;
54- }
55- };
56-
5734 $ searchIndexServiceMock = $ this ->createMock (SearchIndexServiceInterface::class);
5835 $ searchIndexServiceMock ->method ('getMapping ' )->willReturnCallback (function (string $ indexName ) {
5936 return [$ indexName . 'df ' . uniqid ('' , true )];
6037 });
6138
6239 $ this ->cachedSearchIndexMappingService = new CachedSearchIndexMappingService (
63- $ runtimeCacheResolver ,
40+ new RuntimeCacheResolverContract () ,
6441 $ searchIndexServiceMock
6542 );
6643 }
0 commit comments