mirror of
https://github.com/predis/predis.git
synced 2026-08-31 12:43:31 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user