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 99use Palicao \PhpRedisTimeSeries \Exception \RedisClientException ;
1010use RedisException ;
1111
12- final class TimeSeries
12+ class TimeSeries
1313{
1414 public const DUPLICATE_POLICY_BLOCK = 'BLOCK ' ;
1515 public const DUPLICATE_POLICY_FIRST = 'FIRST ' ;
@@ -18,7 +18,7 @@ final class TimeSeries
1818 public const DUPLICATE_POLICY_MAX = 'MAX ' ;
1919 public const DUPLICATE_POLICY_SUM = 'SUM ' ;
2020
21- private const DUPLICATE_POLICIES = [
21+ protected const DUPLICATE_POLICIES = [
2222 self ::DUPLICATE_POLICY_BLOCK ,
2323 self ::DUPLICATE_POLICY_FIRST ,
2424 self ::DUPLICATE_POLICY_LAST ,
@@ -29,7 +29,7 @@ final class TimeSeries
2929
3030
3131 /** @var RedisClientInterface */
32- private $ redis ;
32+ protected $ redis ;
3333
3434 /**
3535 * @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