File tree Expand file tree Collapse file tree 2 files changed +43
-3
lines changed Expand file tree Collapse file tree 2 files changed +43
-3
lines changed Original file line number Diff line number Diff line change 9
9
use Palicao \PhpRedisTimeSeries \Exception \RedisClientException ;
10
10
use RedisException ;
11
11
12
- final class TimeSeries
12
+ class TimeSeries
13
13
{
14
14
public const DUPLICATE_POLICY_BLOCK = 'BLOCK ' ;
15
15
public const DUPLICATE_POLICY_FIRST = 'FIRST ' ;
@@ -18,7 +18,7 @@ final class TimeSeries
18
18
public const DUPLICATE_POLICY_MAX = 'MAX ' ;
19
19
public const DUPLICATE_POLICY_SUM = 'SUM ' ;
20
20
21
- private const DUPLICATE_POLICIES = [
21
+ protected const DUPLICATE_POLICIES = [
22
22
self ::DUPLICATE_POLICY_BLOCK ,
23
23
self ::DUPLICATE_POLICY_FIRST ,
24
24
self ::DUPLICATE_POLICY_LAST ,
@@ -29,7 +29,7 @@ final class TimeSeries
29
29
30
30
31
31
/** @var RedisClientInterface */
32
- private $ redis ;
32
+ protected $ redis ;
33
33
34
34
/**
35
35
* @param RedisClientInterface $redis
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /* @noinspection PhpUnhandledExceptionInspection */
3
+
4
+ declare (strict_types=1 );
5
+
6
+ namespace Palicao \PhpRedisTimeSeries \Tests \Integration ;
7
+
8
+ use Palicao \PhpRedisTimeSeries \Client \RedisClient ;
9
+ use Palicao \PhpRedisTimeSeries \Client \RedisConnectionParams ;
10
+ use Palicao \PhpRedisTimeSeries \TimeSeries ;
11
+ use PHPUnit \Framework \TestCase ;
12
+ use Redis ;
13
+
14
+ class MyTimeSeries extends TimeSeries
15
+ {
16
+ public function getRedis ()
17
+ {
18
+ return $ this ->redis ;
19
+ }
20
+ }
21
+
22
+ class ExtendTest extends TestCase
23
+ {
24
+ private $ redisClient ;
25
+ private $ sut ;
26
+
27
+ public function setUp (): void
28
+ {
29
+ $ host = getenv ('REDIS_HOST ' ) ?: 'php-rts-redis ' ;
30
+ $ port = getenv ('REDIS_PORT ' ) ? (int ) getenv ('REDIS_PORT ' ) : 6379 ;
31
+ $ connectionParams = new RedisConnectionParams ($ host , $ port );
32
+ $ this ->redisClient = new RedisClient (new Redis (), $ connectionParams );
33
+ $ this ->sut = new MyTimeSeries ($ this ->redisClient );
34
+ }
35
+
36
+ public function testRedisPropertyScope (): void
37
+ {
38
+ self ::assertSame ($ this ->redisClient , $ this ->sut ->getRedis ());
39
+ }
40
+ }
You can’t perform that action at this time.
0 commit comments