From ac01c1a17fa66b1f7133ae3deb2589793796ffb7 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Wed, 21 Nov 2012 22:09:05 +0100 Subject: [PATCH] [tests] TTL and PTTL return -2 on non existing keys in Redis >= 2.8. --- .../Command/KeyPreciseTimeToLiveTest.php | 22 ++++++++++--------- tests/Predis/Command/KeyTimeToLiveTest.php | 22 ++++++++++--------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/tests/Predis/Command/KeyPreciseTimeToLiveTest.php b/tests/Predis/Command/KeyPreciseTimeToLiveTest.php index 351a3011..c6a64058 100644 --- a/tests/Predis/Command/KeyPreciseTimeToLiveTest.php +++ b/tests/Predis/Command/KeyPreciseTimeToLiveTest.php @@ -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')); + } } diff --git a/tests/Predis/Command/KeyTimeToLiveTest.php b/tests/Predis/Command/KeyTimeToLiveTest.php index a7ed5c4f..c3f83eee 100644 --- a/tests/Predis/Command/KeyTimeToLiveTest.php +++ b/tests/Predis/Command/KeyTimeToLiveTest.php @@ -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')); + } }