11<?php
22
3- namespace Koded \Caching ;
3+ namespace Tests \ Koded \Caching ;
44
5- use Koded \Caching \Client \{FileClient , MemcachedClient , MemoryClient , PredisClient , RedisClient };
5+ use Koded \Caching \Client \{FileClient , MemcachedClient , MemoryClient , PredisClient , RedisClient , ShmopClient };
6+ use Koded \Caching \CachePool ;
67use PHPUnit \Framework \TestCase ;
78
89class CachePoolFactoryTest extends TestCase
910{
10-
1111 public function test_MemcachedClient ()
1212 {
13+ if (false === \extension_loaded ('memcached ' )) {
14+ $ this ->markTestSkipped ('memcached extension is not loaded ' );
15+ }
1316 $ pool = CachePool::use ('memcached ' );
1417 $ this ->assertAttributeInstanceOf (MemcachedClient::class, 'client ' , $ pool );
1518 }
1619
1720 public function test_RedisClient ()
1821 {
22+ if (false === \extension_loaded ('redis ' )) {
23+ $ this ->markTestSkipped ('redis extension is not loaded ' );
24+ }
1925 $ pool = CachePool::use ('redis ' , [
2026 'host ' => getenv ('REDIS_SERVER_HOST ' ),
2127 ]);
@@ -24,12 +30,24 @@ public function test_RedisClient()
2430
2531 public function test_PredisClient ()
2632 {
33+ if (false === \extension_loaded ('redis ' )) {
34+ $ this ->markTestSkipped ('redis extension is not loaded ' );
35+ }
2736 $ pool = CachePool::use ('predis ' , [
2837 'host ' => getenv ('REDIS_SERVER_HOST ' ),
2938 ]);
3039 $ this ->assertAttributeInstanceOf (PredisClient::class, 'client ' , $ pool );
3140 }
3241
42+ public function test_ShmopClient ()
43+ {
44+ if (false === \extension_loaded ('shmop ' )) {
45+ $ this ->markTestSkipped ('shmop extension is not loaded ' );
46+ }
47+ $ pool = CachePool::use ('shmop ' );
48+ $ this ->assertAttributeInstanceOf (ShmopClient::class, 'client ' , $ pool );
49+ }
50+
3351 public function test_MemoryClient ()
3452 {
3553 $ pool1 = CachePool::use ('memory ' );
0 commit comments