mirror of
https://github.com/predis/predis.git
synced 2026-08-30 04:02:22 +00:00
ClientInterface: update watch command accepting string and string[] (#1476)
This commit is contained in:
@@ -334,7 +334,7 @@ use Predis\Response\Status;
|
||||
* @method mixed multi()
|
||||
* @method mixed unwatch()
|
||||
* @method array waitaof(int $numLocal, int $numReplicas, int $timeout)
|
||||
* @method mixed watch(string $key)
|
||||
* @method mixed watch(string[]|string $keyOrKeys)
|
||||
* @method mixed eval(string $script, int $numkeys, string ...$keyOrArg = null)
|
||||
* @method mixed eval_ro(string $script, array $keys, ...$argument)
|
||||
* @method mixed evalsha(string $script, int $numkeys, string ...$keyOrArg = null)
|
||||
|
||||
@@ -90,6 +90,25 @@ class WATCH_Test extends PredisCommandTestCase
|
||||
$this->assertSame('hijacked', $redis1->get('foo'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group connected
|
||||
* @requiresRedisVersion >= 2.2.0
|
||||
*/
|
||||
public function testWatchMultipleKeysAsListAbortsTransactionOnExternalWriteOperations(): void
|
||||
{
|
||||
$redis1 = $this->getClient();
|
||||
$redis2 = $this->getClient();
|
||||
|
||||
$redis1->mset('foo', 'bar', 'hoge', 'piyo');
|
||||
|
||||
$this->assertEquals('OK', $redis1->watch(['foo', 'hoge']));
|
||||
$this->assertEquals('OK', $redis1->multi());
|
||||
$this->assertEquals('QUEUED', $redis1->set('hoge', 'bar'));
|
||||
$this->assertEquals('OK', $redis2->set('hoge', 'hijacked'));
|
||||
$this->assertNull($redis1->exec());
|
||||
$this->assertSame('hijacked', $redis1->get('hoge'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group connected
|
||||
* @requiresRedisVersion >= 2.2.0
|
||||
|
||||
Reference in New Issue
Block a user