[tests] Apply small changes to commands tests with expirations.

This commit is contained in:
Daniele Alessandri
2015-07-25 09:24:49 +02:00
parent d0012e67ff
commit 59798e1f9e
5 changed files with 25 additions and 39 deletions
+6 -5
View File
@@ -78,13 +78,14 @@ class KeyExpireAtTest extends PredisCommandTestCase
$redis = $this->getClient();
$now = time();
$redis->set('foo', 'bar');
$this->assertEquals('OK', $redis->set('foo', 'bar'));
$this->assertSame(1, $redis->expireat('foo', $now + 1));
$this->assertLessThanOrEqual(1, $redis->ttl('foo'));
$this->sleep(2);
$this->assertThat($redis->ttl('foo'), $this->logicalAnd(
$this->greaterThanOrEqual(0), $this->lessThanOrEqual(1)
));
$this->sleep(2.0);
$this->assertSame(0, $redis->exists('foo'));
}
@@ -96,7 +97,7 @@ class KeyExpireAtTest extends PredisCommandTestCase
$redis = $this->getClient();
$now = time();
$redis->set('foo', 'bar');
$this->assertEquals('OK', $redis->set('foo', 'bar'));
$this->assertSame(1, $redis->expireat('foo', $now - 100));
$this->assertSame(0, $redis->exists('foo'));