File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ class RedisConnection implements CheckInterface
1919 public function __construct (
2020 private DeploymentConfig $ deploymentConfig ,
2121 private Cache $ cache ,
22- private CheckResultFactory $ checkResultFactory
22+ private CheckResultFactory $ checkResultFactory ,
23+ private bool $ enforceRedis = false
2324 ) {
2425 }
2526
@@ -41,7 +42,9 @@ public function run(): CheckResultInterface
4142 );
4243
4344 if ($ this ->checkisRedisEnabled ($ deploymentConfig ) === false ) {
44- $ checkResult ->setStatus (CheckStatus::STATUS_SKIPPED );
45+ $ checkResult ->setStatus (
46+ $ this ->enforceRedis ? CheckStatus::STATUS_FAILED : CheckStatus::STATUS_SKIPPED
47+ );
4548 $ checkResult ->setShortSummary ('Redis disabled ' );
4649 $ checkResult ->setNotificationMessage ('Redis is not enabled ' );
4750 return $ checkResult ;
Original file line number Diff line number Diff line change @@ -25,4 +25,20 @@ public function testRedisConnectionWarning(): void
2525 'Redis connection check should be skipped when Redis is not enabled '
2626 );
2727 }
28+
29+ public function testRedisConnectionEnforceRedis (): void
30+ {
31+ /** @var RedisConnection $redisConnectionCheck */
32+ $ redisConnectionCheck = Bootstrap::getObjectManager ()->create (RedisConnection::class, [
33+ 'enforceRedis ' => true ,
34+ ]);
35+
36+ $ output = $ redisConnectionCheck ->run ();
37+ $ this ->assertEquals ('redis_connection ' , $ output ->getName ());
38+ $ this ->assertEquals (
39+ CheckStatus::STATUS_FAILED ,
40+ $ output ->getStatus (),
41+ 'Redis connection check should be skipped when Redis is not enabled '
42+ );
43+ }
2844}
You can’t perform that action at this time.
0 commit comments