Skip to content

Commit 566fdee

Browse files
Add a regression test for XINFO on empty stream
1 parent 5719c9f commit 566fdee

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/RedisTest.php

+15
Original file line numberDiff line numberDiff line change
@@ -6064,6 +6064,21 @@ public function testXInfo()
60646064
}
60656065
}
60666066

6067+
/* Regression test for issue-1831 (XINFO STREAM on an empty stream) */
6068+
public function testXInfoEmptyStream() {
6069+
/* Configure an empty stream */
6070+
$this->redis->del('s');
6071+
$this->redis->xAdd('s', '*', ['foo' => 'bar']);
6072+
$this->redis->xTrim('s', 0);
6073+
6074+
$arr_info = $this->redis->xInfo('STREAM', 's');
6075+
6076+
$this->assertTrue(is_array($arr_info));
6077+
$this->assertEquals(0, $arr_info['length']);
6078+
$this->assertEquals(NULL, $arr_info['first-entry']);
6079+
$this->assertEquals(NULL, $arr_info['last-entry']);
6080+
}
6081+
60676082
public function testInvalidAuthArgs() {
60686083
$obj_new = $this->newInstance();
60696084

0 commit comments

Comments
 (0)