Skip to content

Commit

Permalink
Merge pull request #101 from Xon/patch-1
Browse files Browse the repository at this point in the history
Test against redis v4 & test phpredis v4 (breaking API change for exists())
  • Loading branch information
colinmollenhour authored May 7, 2018
2 parents 6477dac + 501b633 commit 8ab6db7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ allow_failures:

install:
- yes '' | pecl install -f redis
- wget http://download.redis.io/releases/redis-3.2.11.tar.gz
- tar -xzf redis-3.2.11.tar.gz
- make -s -C redis-3.2.11 -j4
- export PATH=$PATH:$PWD/redis-3.2.11/src/
- wget http://download.redis.io/releases/redis-4.0.8.tar.gz
- tar -xzf redis-4.0.8.tar.gz
- make -s -C redis-4.0.8 -j4
- export PATH=$PATH:$PWD/redis-4.0.8/src/

script:
- phpunit
4 changes: 4 additions & 0 deletions Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,10 @@ public function __call($name, $args)
throw new CredisException($error);
}
break;
case 'exists':
// smooth over phpredis-v4 vs earlier difference to match documented credis return results
$response = (int) $response;
break;
default:
$error = $this->redis->getLastError();
$this->redis->clearLastError();
Expand Down
4 changes: 4 additions & 0 deletions tests/CredisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ public function testScalars()
$this->assertEquals('FOO', $this->credis->get('foo'));
$this->assertFalse($this->credis->get('nil'));

// exists support
$this->assertEquals($this->credis->exists('foo'), 1);
$this->assertEquals($this->credis->exists('nil'), 0);

// Empty string
$this->credis->set('empty','');
$this->assertEquals('', $this->credis->get('empty'));
Expand Down

0 comments on commit 8ab6db7

Please sign in to comment.