mirror of
https://github.com/predis/predis.git
synced 2026-09-14 04:17:14 +00:00
[tests] TTL and PTTL return -2 on non existing keys in Redis >= 2.8.
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user