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

This commit is contained in:
Daniele Alessandri
2012-11-21 22:09:05 +01:00
parent 46920c9c77
commit ac01c1a17f
2 changed files with 24 additions and 20 deletions
@@ -86,16 +86,6 @@ class KeyPreciseTimeToLiveTest extends CommandTestCase
$this->assertLessThanOrEqual(10000, $redis->pttl('foo'));
}
/**
* @group connected
*/
public function testReturnsLessThanZeroOnNonExistingKeys()
{
$redis = $this->getClient();
$this->assertSame(-1, $redis->pttl('foo'));
}
/**
* @group connected
*/
@@ -106,4 +96,16 @@ class KeyPreciseTimeToLiveTest extends CommandTestCase
$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 testReturnsLessThanZeroOnNonExistingKeys()
{
$redis = $this->getClient();
$this->assertLessThanOrEqual(-1, $redis->pttl('foo'));
}
}
+12 -10
View File
@@ -86,16 +86,6 @@ class KeyTimeToLiveTest extends CommandTestCase
$this->assertSame(10, $redis->ttl('foo'));
}
/**
* @group connected
*/
public function testReturnsLessThanZeroOnNonExistingKeys()
{
$redis = $this->getClient();
$this->assertSame(-1, $redis->ttl('foo'));
}
/**
* @group connected
*/
@@ -106,4 +96,16 @@ class KeyTimeToLiveTest extends CommandTestCase
$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 testReturnsLessThanZeroOnNonExistingKeys()
{
$redis = $this->getClient();
$this->assertLessThanOrEqual(-1, $redis->ttl('foo'));
}
}