From 88e6e7624133d67a128b65af6fb3396370b6edad Mon Sep 17 00:00:00 2001 From: Miguel Angel Date: Tue, 17 Dec 2024 17:21:56 -0400 Subject: [PATCH] refactor: rename CacheABC to CacheManagerBase --- .../{CacheABC.php => CacheManagerBase.php} | 2 +- .../Cache/Settings/SettingCacheManager.php | 4 ++-- ...heABCTest.php => CacheManagerBaseTest.php} | 22 +++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) rename ProcessMaker/Cache/{CacheABC.php => CacheManagerBase.php} (97%) rename tests/Feature/Cache/{CacheABCTest.php => CacheManagerBaseTest.php} (75%) diff --git a/ProcessMaker/Cache/CacheABC.php b/ProcessMaker/Cache/CacheManagerBase.php similarity index 97% rename from ProcessMaker/Cache/CacheABC.php rename to ProcessMaker/Cache/CacheManagerBase.php index 74db515f3b..80552bfdf0 100644 --- a/ProcessMaker/Cache/CacheABC.php +++ b/ProcessMaker/Cache/CacheManagerBase.php @@ -6,7 +6,7 @@ use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Redis; -abstract class CacheABC +abstract class CacheManagerBase { /** * The cache connection. diff --git a/ProcessMaker/Cache/Settings/SettingCacheManager.php b/ProcessMaker/Cache/Settings/SettingCacheManager.php index 40767f5ee0..b5ae641a3e 100644 --- a/ProcessMaker/Cache/Settings/SettingCacheManager.php +++ b/ProcessMaker/Cache/Settings/SettingCacheManager.php @@ -6,10 +6,10 @@ use Illuminate\Cache\Repository; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Redis; -use ProcessMaker\Cache\CacheABC; use ProcessMaker\Cache\CacheInterface; +use ProcessMaker\Cache\CacheManagerBase; -class SettingCacheManager extends CacheABC implements CacheInterface +class SettingCacheManager extends CacheManagerBase implements CacheInterface { const DEFAULT_CACHE_DRIVER = 'cache_settings'; diff --git a/tests/Feature/Cache/CacheABCTest.php b/tests/Feature/Cache/CacheManagerBaseTest.php similarity index 75% rename from tests/Feature/Cache/CacheABCTest.php rename to tests/Feature/Cache/CacheManagerBaseTest.php index a923bd385c..12d106d982 100644 --- a/tests/Feature/Cache/CacheABCTest.php +++ b/tests/Feature/Cache/CacheManagerBaseTest.php @@ -5,12 +5,12 @@ use Exception; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Redis; -use ProcessMaker\Cache\CacheABC; +use ProcessMaker\Cache\CacheManagerBase; use Tests\TestCase; -class CacheABCTest extends TestCase +class CacheManagerBaseTest extends TestCase { - protected $cacheABC; + protected $cacheManagerBase; protected function setUp(): void { @@ -28,7 +28,7 @@ protected function tearDown(): void public function testGetKeysByPatternWithValidConnectionAndMatchingKeys() { - $this->cacheABC = $this->getMockForAbstractClass(CacheABC::class); + $this->cacheManagerBase = $this->getMockForAbstractClass(CacheManagerBase::class); $pattern = 'test-pattern'; $prefix = config('cache.prefix'); @@ -42,7 +42,7 @@ public function testGetKeysByPatternWithValidConnectionAndMatchingKeys() ->with($prefix . '*') ->andReturn($keys); - $result = $this->cacheABC->getKeysByPattern($pattern); + $result = $this->cacheManagerBase->getKeysByPattern($pattern); $this->assertCount(2, $result); $this->assertEquals($keys, $result); @@ -50,7 +50,7 @@ public function testGetKeysByPatternWithValidConnectionAndMatchingKeys() public function testGetKeysByPatternWithValidConnectionAndNoMatchingKeys() { - $this->cacheABC = $this->getMockForAbstractClass(CacheABC::class); + $this->cacheManagerBase = $this->getMockForAbstractClass(CacheManagerBase::class); $pattern = 'non-matching-pattern'; $prefix = config('cache.prefix'); @@ -64,7 +64,7 @@ public function testGetKeysByPatternWithValidConnectionAndNoMatchingKeys() ->with($prefix . '*') ->andReturn($keys); - $result = $this->cacheABC->getKeysByPattern($pattern); + $result = $this->cacheManagerBase->getKeysByPattern($pattern); $this->assertCount(0, $result); } @@ -73,17 +73,17 @@ public function testGetKeysByPatternWithInvalidConnection() { config()->set('cache.default', 'array'); - $this->cacheABC = $this->getMockForAbstractClass(CacheABC::class); + $this->cacheManagerBase = $this->getMockForAbstractClass(CacheManagerBase::class); $this->expectException(Exception::class); $this->expectExceptionMessage('`getKeysByPattern` method only supports Redis connections.'); - $this->cacheABC->getKeysByPattern('pattern'); + $this->cacheManagerBase->getKeysByPattern('pattern'); } public function testGetKeysByPatternWithExceptionDuringKeyRetrieval() { - $this->cacheABC = $this->getMockForAbstractClass(CacheABC::class); + $this->cacheManagerBase = $this->getMockForAbstractClass(CacheManagerBase::class); $pattern = 'test-pattern'; $prefix = config('cache.prefix'); @@ -100,7 +100,7 @@ public function testGetKeysByPatternWithExceptionDuringKeyRetrieval() ->with('CacheABC' . 'Redis error') ->once(); - $result = $this->cacheABC->getKeysByPattern($pattern); + $result = $this->cacheManagerBase->getKeysByPattern($pattern); $this->assertCount(0, $result); }