Skip to content

Commit

Permalink
added more test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
thirsch committed Dec 28, 2022
1 parent 9d99caf commit 52c0fc3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/units/RedisMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -1926,6 +1926,11 @@ public function testSscanCommand()
$redisMock->sadd('myKey', ['b1', 'b2', 'b3', 'b4', 'b5', 'b6']);
$redisMock->sadd('myKey', ['c1', 'c2', 'c3']);

// It must return no values, as the key is unknown.
$this->assert
->array($redisMock->sscan('unknown', 1, ['COUNT' => 2]))
->isEqualTo([0, []]);

// It must return two values, start cursor after the first value of the list.
$this->assert
->array($redisMock->sscan('myKey', 1, ['COUNT' => 2]))
Expand All @@ -1944,6 +1949,13 @@ public function testSscanCommand()
->array($redisMock->sscan('myKey', 11, ['MATCH' => 'c*']))
->isEqualTo([0, []]);

$redisMock->expire('myKey', 1);
sleep(2);

// It must return no values, as the key is expired.
$this->assert
->array($redisMock->sscan('myKey', 1, ['COUNT' => 2]))
->isEqualTo([0, []]);
}

public function testBitcountCommand()
Expand Down

0 comments on commit 52c0fc3

Please sign in to comment.