mirror of
https://github.com/predis/predis.git
synced 2026-09-14 04:17:14 +00:00
Updated RESP3 modules responses
This commit is contained in:
@@ -32,7 +32,6 @@ jobs:
|
||||
- '8.1'
|
||||
- '8.2'
|
||||
redis:
|
||||
- latest
|
||||
- edge
|
||||
|
||||
steps:
|
||||
|
||||
@@ -102,7 +102,7 @@ class JSONARRAPPEND_Test extends PredisCommandTestCase
|
||||
$actualResponse = $redis->jsonarrappend('key', '$.key2', '"value3"');
|
||||
|
||||
$this->assertSame([3], $actualResponse);
|
||||
$this->assertSame([['{"key1":"value1","key2":["value1","value2","value3"]}']], $redis->jsonget('key'));
|
||||
$this->assertSame('[{"key1":"value1","key2":["value1","value2","value3"]}]', $redis->jsonget('key'));
|
||||
}
|
||||
|
||||
public function jsonProvider(): array
|
||||
|
||||
@@ -104,7 +104,7 @@ class JSONARRINSERT_Test extends PredisCommandTestCase
|
||||
$actualResponse = $redis->jsonarrinsert('key', '$.key2', 1, '"value2"');
|
||||
|
||||
$this->assertSame([3], $actualResponse);
|
||||
$this->assertSame([['{"key1":"value1","key2":["value1","value2","value3"]}']], $redis->jsonget('key'));
|
||||
$this->assertSame('[{"key1":"value1","key2":["value1","value2","value3"]}]', $redis->jsonget('key'));
|
||||
}
|
||||
|
||||
public function jsonProvider(): array
|
||||
|
||||
@@ -100,7 +100,7 @@ class JSONARRPOP_Test extends PredisCommandTestCase
|
||||
$actualResponse = $redis->jsonarrpop('key', '$.key2', -1);
|
||||
|
||||
$this->assertSame(['"value2"'], $actualResponse);
|
||||
$this->assertSame([['{"key1":"value1","key2":["value1"]}']], $redis->jsonget('key'));
|
||||
$this->assertSame('[{"key1":"value1","key2":["value1"]}]', $redis->jsonget('key'));
|
||||
}
|
||||
|
||||
public function jsonProvider(): array
|
||||
|
||||
@@ -102,7 +102,7 @@ class JSONARRTRIM_Test extends PredisCommandTestCase
|
||||
$actualResponse = $redis->jsonarrtrim('key', '$.key2', 1, 4);
|
||||
|
||||
$this->assertSame([4], $actualResponse);
|
||||
$this->assertSame([['{"key1":"value1","key2":[2,3,4,5]}']], $redis->jsonget('key'));
|
||||
$this->assertSame('[{"key1":"value1","key2":[2,3,4,5]}]', $redis->jsonget('key'));
|
||||
}
|
||||
|
||||
public function jsonProvider(): array
|
||||
|
||||
@@ -98,7 +98,7 @@ class JSONCLEAR_Test extends PredisCommandTestCase
|
||||
$actualResponse = $redis->jsonclear('key', '$.key2');
|
||||
|
||||
$this->assertSame(1, $actualResponse);
|
||||
$this->assertSame([['{"key1":"value1","key2":[]}']], $redis->jsonget('key'));
|
||||
$this->assertSame('[{"key1":"value1","key2":[]}]', $redis->jsonget('key'));
|
||||
}
|
||||
|
||||
public function jsonProvider(): array
|
||||
|
||||
@@ -98,7 +98,7 @@ class JSONDEL_Test extends PredisCommandTestCase
|
||||
$actualResponse = $redis->jsondel('key', '$.key2');
|
||||
|
||||
$this->assertSame(1, $actualResponse);
|
||||
$this->assertSame([['{"key1":"value1"}']], $redis->jsonget('key'));
|
||||
$this->assertSame('[{"key1":"value1"}]', $redis->jsonget('key'));
|
||||
}
|
||||
|
||||
public function jsonProvider(): array
|
||||
|
||||
@@ -98,7 +98,7 @@ class JSONFORGET_Test extends PredisCommandTestCase
|
||||
$actualResponse = $redis->jsonforget('key', '$.key2');
|
||||
|
||||
$this->assertSame(1, $actualResponse);
|
||||
$this->assertSame([['{"key1":"value1"}']], $redis->jsonget('key'));
|
||||
$this->assertSame('[{"key1":"value1"}]', $redis->jsonget('key'));
|
||||
}
|
||||
|
||||
public function jsonProvider(): array
|
||||
|
||||
@@ -94,7 +94,7 @@ class JSONGET_Test extends PredisCommandTestCase
|
||||
|
||||
$redis->jsonset('key', '$', '{"key1":"value1","key2":"value2"}');
|
||||
$this->assertSame(
|
||||
[['{"key1":"value1","key2":"value2"}']],
|
||||
'[{"key1":"value1","key2":"value2"}]',
|
||||
$redis->jsonget('key')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class JSONOBJKEYS_Test extends PredisCommandTestCase
|
||||
|
||||
$redis->jsonset('key', '$', '{"key1":"value1","key2":"value2"}');
|
||||
|
||||
$this->assertSame(['key1', 'key2'], $redis->jsonobjkeys('key'));
|
||||
$this->assertSame([['key1', 'key2']], $redis->jsonobjkeys('key'));
|
||||
}
|
||||
|
||||
public function jsonProvider(): array
|
||||
|
||||
@@ -92,7 +92,7 @@ class JSONOBJLEN_Test extends PredisCommandTestCase
|
||||
|
||||
$redis->jsonset('key', '$', '{"key1":"value1","key2":"value2"}');
|
||||
|
||||
$this->assertSame(2, $redis->jsonobjlen('key'));
|
||||
$this->assertSame([2], $redis->jsonobjlen('key'));
|
||||
}
|
||||
|
||||
public function jsonProvider(): array
|
||||
|
||||
@@ -97,7 +97,7 @@ class JSONSET_Test extends PredisCommandTestCase
|
||||
|
||||
$this->assertEquals('OK', $redis->jsonset('key', '$', '{"key1":"value1","key2":"value2"}'));
|
||||
$this->assertEquals('OK', $redis->jsonset('key', '$', '{"key3":"value3"}'));
|
||||
$this->assertSame([['{"key3":"value3"}']], $redis->jsonget('key'));
|
||||
$this->assertSame('[{"key3":"value3"}]', $redis->jsonget('key'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -100,7 +100,7 @@ class JSONSTRAPPEND_Test extends PredisCommandTestCase
|
||||
$actualResponse = $redis->jsonstrappend('key', '$.key2', '"foo"');
|
||||
|
||||
$this->assertSame([9], $actualResponse);
|
||||
$this->assertSame([['{"key1":"value1","key2":"value2foo"}']], $redis->jsonget('key'));
|
||||
$this->assertSame('[{"key1":"value1","key2":"value2foo"}]', $redis->jsonget('key'));
|
||||
}
|
||||
|
||||
public function jsonProvider(): array
|
||||
|
||||
@@ -98,7 +98,7 @@ class JSONTOGGLE_Test extends PredisCommandTestCase
|
||||
$actualResponse = $redis->jsontoggle('key', '$.key1');
|
||||
|
||||
$this->assertSame([0], $actualResponse);
|
||||
$this->assertSame([['{"key1":false}']], $redis->jsonget('key'));
|
||||
$this->assertSame('[{"key1":false}]', $redis->jsonget('key'));
|
||||
}
|
||||
|
||||
public function jsonProvider(): array
|
||||
|
||||
@@ -122,12 +122,19 @@ class FTAGGREGATE_Test extends PredisCommandTestCase
|
||||
{
|
||||
$redis = $this->getResp3Client();
|
||||
$expectedResponse = [
|
||||
2,
|
||||
[
|
||||
'country', 'Ukraine', 'birth', '1995', 'country_birth_Vlad_count', '2',
|
||||
],
|
||||
[
|
||||
'country', 'Israel', 'birth', '1994', 'country_birth_Vlad_count', '1',
|
||||
'attributes' => [],
|
||||
'error' => [],
|
||||
'total_results' => 2,
|
||||
'format' => 'STRING',
|
||||
'results' => [
|
||||
[
|
||||
'extra_attributes' => ['country' => 'Ukraine', 'birth' => '1995', 'country_birth_Vlad_count' => '2'],
|
||||
'values' => [],
|
||||
],
|
||||
[
|
||||
'extra_attributes' => ['country' => 'Israel', 'birth' => '1994', 'country_birth_Vlad_count' => '1'],
|
||||
'values' => [],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ class FTCONFIG_Test extends PredisCommandTestCase
|
||||
{
|
||||
$redis = $this->getResp3Client();
|
||||
|
||||
$this->assertEquals([['MAXEXPANSIONS', '200']], $redis->ftconfig->get('MAXEXPANSIONS'));
|
||||
$this->assertEquals(['MAXEXPANSIONS' => '200'], $redis->ftconfig->get('MAXEXPANSIONS'));
|
||||
$this->assertEmpty($redis->ftconfig->get('foobar'));
|
||||
}
|
||||
|
||||
|
||||
@@ -145,10 +145,28 @@ class FTCURSOR_Test extends PredisCommandTestCase
|
||||
|
||||
$expectedResponse = [
|
||||
[
|
||||
'country', 'Ukraine', 'birth', '1995', 'country_birth_Vlad_count', '2',
|
||||
'attributes' => [],
|
||||
'error' => [],
|
||||
'total_results' => 2,
|
||||
'format' => 'STRING',
|
||||
'results' => [
|
||||
[
|
||||
'extra_attributes' => ['country' => 'Ukraine', 'birth' => '1995', 'country_birth_Vlad_count' => '2'],
|
||||
'values' => [],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'country', 'Israel', 'birth', '1994', 'country_birth_Vlad_count', '1',
|
||||
'attributes' => [],
|
||||
'error' => [],
|
||||
'total_results' => 0,
|
||||
'format' => 'STRING',
|
||||
'results' => [
|
||||
[
|
||||
'extra_attributes' => ['country' => 'Israel', 'birth' => '1994', 'country_birth_Vlad_count' => '1'],
|
||||
'values' => [],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
@@ -184,7 +202,7 @@ class FTCURSOR_Test extends PredisCommandTestCase
|
||||
$actualResponse = [];
|
||||
|
||||
while ($cursor) {
|
||||
$actualResponse[] = $response[1];
|
||||
$actualResponse[] = $response;
|
||||
[$response, $cursor] = $redis->ftcursor->read('idx', $cursor);
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ class FTINFO_Test extends PredisCommandTestCase
|
||||
$this->assertEquals('OK', $createResponse);
|
||||
|
||||
$actualResponse = $redis->ftinfo('index');
|
||||
$this->assertEquals('index', $actualResponse[1]);
|
||||
$this->assertEquals('index', $actualResponse['index_name']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -131,7 +131,15 @@ class FTSEARCH_Test extends PredisCommandTestCase
|
||||
public function testSearchValuesByHashIndexResp3(): void
|
||||
{
|
||||
$redis = $this->getResp3Client();
|
||||
$expectedResponse = [1, 'doc:1', ['should_return', 'value1']];
|
||||
$expectedResponse = [
|
||||
'attributes' => [],
|
||||
'error' => [],
|
||||
'total_results' => 1,
|
||||
'format' => 'STRING',
|
||||
'results' => [
|
||||
['id' => 'doc:1', 'extra_attributes' => ['should_return' => 'value1'], 'values' => []],
|
||||
],
|
||||
];
|
||||
|
||||
$hashResponse = $redis->hmset('doc:1', 'field1', 'value1', 'field2', 'value2');
|
||||
$this->assertEquals('OK', $hashResponse);
|
||||
|
||||
@@ -94,7 +94,11 @@ class FTSPELLCHECK_Test extends PredisCommandTestCase
|
||||
public function testSpellcheckReturnsPossibleSuggestionsToGivenMisspelledTermResp3(): void
|
||||
{
|
||||
$redis = $this->getResp3Client();
|
||||
$expectedResponse = [['TERM', 'held', [[0.0, 'hello'], [0.0, 'help']]]];
|
||||
$expectedResponse = [
|
||||
'results' => [
|
||||
'held' => [['hello' => 0.0], ['help' => 0.0]],
|
||||
],
|
||||
];
|
||||
|
||||
$this->assertEquals('OK', $redis->ftcreate(
|
||||
'index',
|
||||
|
||||
@@ -91,7 +91,7 @@ class FTSYNDUMP_Test extends PredisCommandTestCase
|
||||
public function testDumpReturnsContentOfSynonymGroupFromGivenIndexResp3(): void
|
||||
{
|
||||
$redis = $this->getResp3Client();
|
||||
$expectedResponse = ['term1', ['synonym1'], 'term2', ['synonym1']];
|
||||
$expectedResponse = ['term1' => ['synonym1'], 'term2' => ['synonym1']];
|
||||
|
||||
$this->assertEquals(
|
||||
'OK',
|
||||
|
||||
Reference in New Issue
Block a user