mirror of
https://github.com/predis/predis.git
synced 2026-10-10 05:47:02 +00:00
Fix prefixes for LMOVE and BLMOVE (#1455)
Co-authored-by: Till Krüss <tillkruss@users.noreply.github.com>
This commit is contained in:
@@ -120,6 +120,37 @@ class KeyPrefixProcessorTest extends PredisTestCase
|
||||
$this->assertEmpty($command->getArguments());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testPrefixFirstTwo(): void
|
||||
{
|
||||
$arguments = ['1st', '2nd', '3rd', '4th'];
|
||||
$expected = ['prefix:1st', 'prefix:2nd', '3rd', '4th'];
|
||||
|
||||
$command = $this->getMockForAbstractClass('Predis\Command\Command');
|
||||
$command->setRawArguments($arguments);
|
||||
|
||||
KeyPrefixProcessor::firstTwo($command, 'prefix:');
|
||||
$this->assertSame($expected, $command->getArguments());
|
||||
|
||||
// One argument
|
||||
$arguments = ['1st'];
|
||||
$expected = ['prefix:1st'];
|
||||
|
||||
$command = $this->getMockForAbstractClass('Predis\Command\Command');
|
||||
$command->setRawArguments($arguments);
|
||||
|
||||
KeyPrefixProcessor::firstTwo($command, 'prefix:');
|
||||
$this->assertSame($expected, $command->getArguments());
|
||||
|
||||
// Empty arguments
|
||||
$command = $this->getMockForAbstractClass('Predis\Command\Command');
|
||||
|
||||
KeyPrefixProcessor::firstTwo($command, 'prefix:');
|
||||
$this->assertEmpty($command->getArguments());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
@@ -978,6 +1009,14 @@ class KeyPrefixProcessorTest extends PredisTestCase
|
||||
['key'],
|
||||
['prefix:key'],
|
||||
],
|
||||
['LMOVE',
|
||||
['key:source', 'key:destination', 'left', 'right'],
|
||||
['prefix:key:source', 'prefix:key:destination', 'left', 'right'],
|
||||
],
|
||||
['BLMOVE',
|
||||
['key:source', 'key:destination', 'left', 'right', 10],
|
||||
['prefix:key:source', 'prefix:key:destination', 'left', 'right', 10],
|
||||
],
|
||||
/* ---------------- Redis 7.0 ---------------- */
|
||||
['EXPIRETIME',
|
||||
['key'],
|
||||
|
||||
Reference in New Issue
Block a user