10000 Remove validator Redis instance in tests · symfony/symfony@08e92bf · GitHub
[go: up one dir, main page]

Skip to content

Commit 08e92bf

Browse files
committed
Remove validator Redis instance in tests
1 parent 58d3353 commit 08e92bf

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ abstract class AbstractRedisSessionHandlerTestCase extends TestCase
3232
*/
3333
protected $redisClient;
3434

35-
/**
36-
* @var \Redis
37-
*/
38-
protected $validator;
39-
4035
/**
4136
* @return \Redis|\RedisArray|\RedisCluster|\Predis\Client
4237
*/
@@ -52,9 +47,6 @@ protected function setUp()
5247

5348
$host = getenv('REDIS_HOST') ?: 'localhost';
5449

55-
$this->validator = new \Redis();
56-
$this->validator->connect($host);
57-
5850
$this->redisClient = $this->createRedisClient($host);
5951
$this->storage = new RedisSessionHandler(
6052
$this->redisClient,
@@ -154,24 +146,24 @@ public function getOptionFixtures(): array
154146
protected function setFixture($key, $value, $ttl = null)
155147
{
156148
if (null !== $ttl) {
157-
$this->validator->setex($key, $ttl, $value);
149+
$this->redisClient->setex($key, $ttl, $value);
158150
} else {
159-
$this->validator->set($key, $value);
151+
$this->redisClient->set($key, $value);
160152
}
161153
}
162154

163155
protected function getFixture($key)
164156
{
165-
return $this->validator->get($key);
157+
return $this->redisClient->get($key);
166158
}
167159

168160
protected function hasFixture($key): bool
169161
{
170-
return $this->validator->exists($key);
162+
return $this->redisClient->exists($key);
171163
}
172164

173165
protected function fixtureTtl($key): int
174166
{
175-
return $this->validator->ttl($key);
167+
return $this->redisClient->ttl($key);
176168
}
177169
}

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/RedisClusterSessionHandlerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
class RedisClusterSessionHandlerTest extends AbstractRedisSessionHandlerTestCase
1515
{
16-
// TODO : use setUp ?
1716
public static function setupBeforeClass()
1817
{
1918
if (!class_exists('RedisCluster')) {

0 commit comments

Comments
 (0)
0