[tests] Improve tests of TTL.

This commit is contained in:
Daniele Alessandri
2013-11-29 23:27:18 +01:00
parent d52daacba9
commit 09b0750cb7
+6 -4
View File
@@ -85,13 +85,15 @@ class KeyTimeToLiveTest extends CommandTestCase
/**
* @group connected
* @todo TTL changed in Redis >= 2.8 to return -2 on non existing keys, we
* should handle this case with a better solution than the current one.
*/
public function testReturnsLessThanZeroOnNonExistingKeys()
{
$redis = $this->getClient();
$this->executeOnRedisVersion('2.8.0', '<', function ($test) {
$test->assertSame(-1, $test->getClient()->ttl('foo'));
});
$this->assertLessThanOrEqual(-1, $redis->ttl('foo'));
$this->executeOnRedisVersion('2.8.0', '>=', function ($test) {
$test->assertSame(-2, $test->getClient()->ttl('foo'));
});
}
}