Testing code against Redis 7 (#764)

* redis 7 init

fix typo

add the new returns

* having a full sentence for the exception message
This commit is contained in:
Zaher Ghaibeh
2022-05-12 22:23:51 +03:00
committed by GitHub
parent e382bedb27
commit 3c01ccc94c
3 changed files with 30 additions and 3 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ jobs:
fail-fast: false
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
redis-versions: ['3', '4', '5', '6']
redis-versions: ['3', '4', '5', '6', '7']
steps:
- name: Checkout
+22 -1
View File
@@ -106,13 +106,34 @@ class COMMAND_Test extends PredisCommandTestCase
// NOTE: starting with Redis 6.0 and the introduction of Access Control
// Lists, COMMAND INFO returns an additional array for each specified
// command in yhe request with a list of the ACL categories associated
// command in the request with a list of the ACL categories associated
// to a command. We simply append this additional array in the expected
// response if the test suite is executed against Redis >= 6.0.
if ($this->isRedisServerVersion('>=', '6.0')) {
$expected[0][] = array('@read', '@string', '@fast');
}
// NOTE: starting with Redis 7.0 COMMAND INFO returns an additional arrays:
// - Command tips: https://redis.io/topics/command-tips.
// - Key specifications: https://redis.io/topics/key-specs.
// - Subcommands: https://redis.io/commands/command/#subcommands.
// We simply append this additional array in the expected response if the
// test suite is executed against Redis >= 7.0.
if ($this->isRedisServerVersion('>=', '7.0')) {
$expected[0][] = array();
$expected[0][] = array(
array(
'flags',
array('RO','access'),
'begin_search',
array('type','index','spec', array('index',1)),
'find_keys',
array('type','range','spec', array('lastkey',0,'keystep',1,'limit',0))
)
);
$expected[0][] = array();
}
$this->assertCount(1, $response = $redis->command('INFO', 'GET'));
// NOTE: we use assertEquals instead of assertSame because Redis returns
+7 -1
View File
@@ -143,7 +143,13 @@ class CONFIG_Test extends PredisCommandTestCase
public function testThrowsExceptionWhenSettingUnknownConfiguration(): void
{
$this->expectException('Predis\Response\ServerException');
$this->expectExceptionMessage('ERR Unsupported CONFIG parameter: foo');
if ($this->isRedisServerVersion('<=', '6.0')) {
$this->expectExceptionMessage('ERR Unsupported CONFIG parameter: foo');
}
if ($this->isRedisServerVersion('>=', '7.0')) {
$this->expectExceptionMessage("ERR Unknown option or number of arguments for CONFIG SET - 'foo'");
}
$redis = $this->getClient();