Skip to content

Commit f4cfc0a

Browse files
committed
Fix phpredis#1056 failed test on 32bits
1 parent 61a7e48 commit f4cfc0a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/RedisTest.php

+8-5
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ public function testBitsets() {
167167
// Verify valid offset ranges
168168
$this->assertFalse($this->redis->getBit('key', -1));
169169

170-
$this->redis->setBit('key', 4294967295, 1);
171-
$this->assertEquals(1, $this->redis->getBit('key', 4294967295));
170+
$this->redis->setBit('key', 0x7fffffff, 1);
171+
$this->assertEquals(1, $this->redis->getBit('key', 0x7fffffff));
172172
}
173173

174174
public function testBitPos() {
@@ -476,6 +476,9 @@ public function testSetNX() {
476476
}
477477

478478
public function testExpireAtWithLong() {
479+
if (PHP_INT_SIZE != 8) {
480+
$this->markTestSkipped('64 bits only');
481+
}
479482
$longExpiryTimeExceedingInt = 3153600000;
480483
$this->redis->del('key');
481484
$this->assertTrue($this->redis->setex('key', $longExpiryTimeExceedingInt, 'val') === TRUE);
@@ -515,7 +518,7 @@ public function testIncr()
515518
$this->assertTrue("abc" === $this->redis->get('key'));
516519

517520
$this->redis->set('key', 0);
518-
$this->assertEquals(2147483648, $this->redis->incrby('key', 2147483648));
521+
$this->assertEquals(PHP_INT_MAX, $this->redis->incrby('key', PHP_INT_MAX));
519522
}
520523

521524
public function testIncrByFloat()
@@ -2296,8 +2299,8 @@ public function testHashes() {
22962299
$this->assertTrue(3 === $this->redis->hIncrBy('h', 'x', 1));
22972300
$this->assertTrue(2 === $this->redis->hIncrBy('h', 'x', -1));
22982301
$this->assertTrue("2" === $this->redis->hGet('h', 'x'));
2299-
$this->assertTrue(1000000000002 === $this->redis->hIncrBy('h', 'x', 1000000000000));
2300-
$this->assertTrue("1000000000002" === $this->redis->hGet('h', 'x'));
2302+
$this->assertTrue(PHP_INT_MAX === $this->redis->hIncrBy('h', 'x', PHP_INT_MAX-2));
2303+
$this->assertTrue("".PHP_INT_MAX === $this->redis->hGet('h', 'x'));
23012304

23022305
$this->redis->hSet('h', 'y', 'not-a-number');
23032306
$this->assertTrue(FALSE === $this->redis->hIncrBy('h', 'y', 1));

0 commit comments

Comments
 (0)