Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 77aebad

Browse files
Tests for doubling up on pipeline/multi calls
1 parent d11798e commit 77aebad

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

tests/RedisClusterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function testWait() { return $this->markTestSkipped(); }
3333
public function testSelect() { return $this->markTestSkipped(); }
3434
public function testReconnectSelect() { return $this->markTestSkipped(); }
3535
public function testMultipleConnect() { return $this->markTestSkipped(); }
36+
public function testDoublePipeNoOp() { return $this->markTestSkipped(); }
3637

3738
/* Load our seeds on construction */
3839
public function __construct() {

tests/RedisTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2554,6 +2554,31 @@ public function testPipelineMultiExec()
25542554
$this->assertEquals(5, count($ret)); // should be 5 atomic operations
25552555
}
25562556

2557+
/* Github issue #1211 (ignore redundant calls to pipeline or multi) */
2558+
public function testDoublePipeNoOp() {
2559+
/* Only the first pipeline should be honored */
2560+
for ($i = 0; $i < 6; $i++) {
2561+
$this->redis->pipeline();
2562+
}
2563+
2564+
/* Set and get in our pipeline */
2565+
$this->redis->set('pipecount','over9000')->get('pipecount');
2566+
2567+
$data = $this->redis->exec();
2568+
$this->assertEquals(Array(true,'over9000'), $data);
2569+
2570+
/* Only the first MULTI should be honored */
2571+
for ($i = 0; $i < 6; $i++) {
2572+
$this->redis->multi();
2573+
}
2574+
2575+
/* Set and get in our MULTI block */
2576+
$this->redis->set('multicount', 'over9000')->get('multicount');
2577+
2578+
$data = $this->redis->exec();
2579+
$this->assertEquals(Array(true, 'over9000'), $data);
2580+
}
2581+
25572582
protected function sequence($mode) {
25582583
$ret = $this->redis->multi($mode)
25592584
->set('x', 42)

0 commit comments

Comments
 (0)