mirror of
https://github.com/predis/predis.git
synced 2026-10-09 05:16:32 +00:00
[tests] Apply small changes to commands tests with expirations.
This commit is contained in:
@@ -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'));
|
||||
|
||||
Reference in New Issue
Block a user