File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,6 +112,17 @@ public function testInvalidateSetsToFalse(): void
112112
113113 public function testGetMemcacheCreatesConnectionOnFirstCall (): void
114114 {
115+ // Skip if Memcached server not available (though Memcached doesn't connect until use)
116+ if (class_exists ('\Memcached ' , false )) {
117+ try {
118+ $ testMemcached = new \Memcached ();
119+ $ testMemcached ->addServer ('127.0.0.1 ' , 11211 );
120+ // Memcached doesn't connect until first operation, so this is usually safe
121+ } catch (\Throwable $ e ) {
122+ $ this ->markTestSkipped ('Memcached not available: ' . $ e ->getMessage ());
123+ }
124+ }
125+
115126 // Reset static memcache
116127 $ reflection = new \ReflectionClass (Memcache::class);
117128 $ property = $ reflection ->getProperty ('_memcache ' );
Original file line number Diff line number Diff line change @@ -134,6 +134,20 @@ public function testInvalidateDeletesKey(): void
134134
135135 public function testGetRedisCreatesConnectionOnFirstCall (): void
136136 {
137+ // Skip if we can't connect to Redis server
138+ if (class_exists ('\Redis ' , false )) {
139+ try {
140+ $ testRedis = new \Redis ();
141+ @$ testRedis ->connect ('127.0.0.1 ' , 6379 , 0.1 );
142+ if (!$ testRedis ->ping ()) {
143+ $ this ->markTestSkipped ('Redis server not available ' );
144+ }
145+ $ testRedis ->close ();
146+ } catch (\Throwable $ e ) {
147+ $ this ->markTestSkipped ('Redis server not available: ' . $ e ->getMessage ());
148+ }
149+ }
150+
137151 // Reset static redis
138152 $ reflection = new \ReflectionClass (Redis::class);
139153 $ property = $ reflection ->getProperty ('_redis ' );
You can’t perform that action at this time.
0 commit comments