Skip to content

Commit 8ab6db7

Browse files
Merge pull request #101 from Xon/patch-1
Test against redis v4 & test phpredis v4 (breaking API change for exists())
2 parents 6477dac + 501b633 commit 8ab6db7

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ allow_failures:
1313

1414
install:
1515
- yes '' | pecl install -f redis
16-
- wget http://download.redis.io/releases/redis-3.2.11.tar.gz
17-
- tar -xzf redis-3.2.11.tar.gz
18-
- make -s -C redis-3.2.11 -j4
19-
- export PATH=$PATH:$PWD/redis-3.2.11/src/
16+
- wget http://download.redis.io/releases/redis-4.0.8.tar.gz
17+
- tar -xzf redis-4.0.8.tar.gz
18+
- make -s -C redis-4.0.8 -j4
19+
- export PATH=$PATH:$PWD/redis-4.0.8/src/
2020

2121
script:
2222
- phpunit

Client.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,10 @@ public function __call($name, $args)
11861186
throw new CredisException($error);
11871187
}
11881188
break;
1189+
case 'exists':
1190+
// smooth over phpredis-v4 vs earlier difference to match documented credis return results
1191+
$response = (int) $response;
1192+
break;
11891193
default:
11901194
$error = $this->redis->getLastError();
11911195
$this->redis->clearLastError();

tests/CredisTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ public function testScalars()
6565
$this->assertEquals('FOO', $this->credis->get('foo'));
6666
$this->assertFalse($this->credis->get('nil'));
6767

68+
// exists support
69+
$this->assertEquals($this->credis->exists('foo'), 1);
70+
$this->assertEquals($this->credis->exists('nil'), 0);
71+
6872
// Empty string
6973
$this->credis->set('empty','');
7074
$this->assertEquals('', $this->credis->get('empty'));

0 commit comments

Comments
 (0)