Skip to content

Commit

Permalink
refactor: rename CacheABC to CacheManagerBase
Browse files Browse the repository at this point in the history
  • Loading branch information
devmiguelangel committed Dec 17, 2024
1 parent aec1487 commit 88e6e76
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redis;

abstract class CacheABC
abstract class CacheManagerBase
{
/**
* The cache connection.
Expand Down
4 changes: 2 additions & 2 deletions ProcessMaker/Cache/Settings/SettingCacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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');
Expand All @@ -42,15 +42,15 @@ 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);
}

public function testGetKeysByPatternWithValidConnectionAndNoMatchingKeys()
{
$this->cacheABC = $this->getMockForAbstractClass(CacheABC::class);
$this->cacheManagerBase = $this->getMockForAbstractClass(CacheManagerBase::class);

$pattern = 'non-matching-pattern';
$prefix = config('cache.prefix');
Expand All @@ -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);
}
Expand All @@ -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');
Expand All @@ -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);
}
Expand Down

0 comments on commit 88e6e76

Please sign in to comment.