trait RedisTestInterfaceTrait in Redis 8
Hierarchy
- trait \Drupal\Tests\redis\Traits\RedisTestInterfaceTrait
6 files declare their use of RedisTestInterfaceTrait
- RedisCacheTest.php in tests/
src/ Kernel/ RedisCacheTest.php - RedisFloodTest.php in tests/
src/ Kernel/ RedisFloodTest.php - RedisLockFunctionalTest.php in tests/
src/ Functional/ Lock/ RedisLockFunctionalTest.php - RedisLockTest.php in tests/
src/ Kernel/ RedisLockTest.php - RedisQueueTest.php in tests/
src/ Kernel/ RedisQueueTest.php
File
- tests/
src/ Traits/ RedisTestInterfaceTrait.php, line 7
Namespace
Drupal\Tests\redis\TraitsView source
trait RedisTestInterfaceTrait {
/**
* Uses an env variable to set the redis client to use for this test.
*/
public function setUpSettings() {
// Write redis_interface settings manually.
$redis_interface = self::getRedisInterfaceEnv();
$settings = Settings::getAll();
$settings['redis.connection']['interface'] = $redis_interface;
new Settings($settings);
}
/**
* Uses an env variable to set the redis client to use for this test.
*/
public function getRedisInterfaceEnv() {
// Get REDIS_INTERFACE from env variable.
$redis_interface = getenv('REDIS_INTERFACE');
// Default to PhpRedis is env variable not available.
if ($redis_interface == FALSE) {
$redis_interface = 'PhpRedis';
}
return $redis_interface;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RedisTestInterfaceTrait:: |
public | function | Uses an env variable to set the redis client to use for this test. | |
RedisTestInterfaceTrait:: |
public | function | Uses an env variable to set the redis client to use for this test. |