Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[tests] TTL and PTTL return -2 on non existing keys in Redis >= 2.8.

  • Loading branch information...
commit ac01c1a17fa66b1f7133ae3deb2589793796ffb7 1 parent 46920c9
@nrk authored
View
10 tests/Predis/Command/KeyPreciseTimeToLiveTest.php
@@ -89,21 +89,23 @@ public function testReturnsTTL()
/**
* @group connected
*/
- public function testReturnsLessThanZeroOnNonExistingKeys()
+ public function testReturnsLessThanZeroOnNonExpiringKeys()
{
$redis = $this->getClient();
+ $redis->set('foo', 'bar');
$this->assertSame(-1, $redis->pttl('foo'));
}
/**
* @group connected
+ * @todo PTTL 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 testReturnsLessThanZeroOnNonExpiringKeys()
+ public function testReturnsLessThanZeroOnNonExistingKeys()
{
$redis = $this->getClient();
- $redis->set('foo', 'bar');
- $this->assertSame(-1, $redis->pttl('foo'));
+ $this->assertLessThanOrEqual(-1, $redis->pttl('foo'));
}
}
View
10 tests/Predis/Command/KeyTimeToLiveTest.php
@@ -89,21 +89,23 @@ public function testReturnsTTL()
/**
* @group connected
*/
- public function testReturnsLessThanZeroOnNonExistingKeys()
+ public function testReturnsLessThanZeroOnNonExpiringKeys()
{
$redis = $this->getClient();
+ $redis->set('foo', 'bar');
$this->assertSame(-1, $redis->ttl('foo'));
}
/**
* @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 testReturnsLessThanZeroOnNonExpiringKeys()
+ public function testReturnsLessThanZeroOnNonExistingKeys()
{
$redis = $this->getClient();
- $redis->set('foo', 'bar');
- $this->assertSame(-1, $redis->ttl('foo'));
+ $this->assertLessThanOrEqual(-1, $redis->ttl('foo'));
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.