Fixes for Redis extension and associated test suite
commit47b3503c741d2124ed972d1e617eb712148c92c8
authorOri Livneh <ori@wikimedia.org>
Thu, 31 Jul 2014 17:51:25 +0000 (31 10:51 -0700)
committerfacebook-github-bot <githubbot@fb.com>
Thu, 31 Jul 2014 18:00:22 +0000 (31 11:00 -0700)
tree699416519c7460109cbe6b246237f72d6565bd46
parent31de467b698406fdf1d8cdb8b21699241b8626ef
Fixes for Redis extension and associated test suite

Summary: * Fix a couple of tests that were broken by 91b1918 adding two lines to the
  wrong expect file (list.php.expect instead of info.php.expect).
* Fixed hphp/test/slow/ext_redis/watch.php.expect to expect the correct
  behavior. (Tested by verifying with Zend + phpredis.)
* Make the key prefix set by the test suite include the md5 of the file path
  plus UNIX timestamp representing the test suite initialization. This makes
  the tests not break when the path exceeds the redis key length limit and it
  makes repeated test runs not conflict with one another.
* Make Redis::sRandMember apply the key prefix (if one exists).
* Make Redis::get() and Redis::h{m}get() return false rather than null for
  missing keys or fields, matching the behavior of phpredis.

Minimal test case for the false / null behavior:

    <?php
    $redis = new Redis;
    $redis->connect("localhost");
    var_dump($redis->get("nonexistent-key"));
    $redis->hMset('ice_cream', array('flavor' => 'vanilla'));
    var_dump($redi

Closes https://github.com/facebook/hhvm/pull/3318

Reviewed By: bsimmers, ptarjan

Differential Revision: D1467674

Pulled By: svcscm
hphp/system/php/redis/Redis.php
hphp/test/slow/ext_redis/hmsetget.php.expect
hphp/test/slow/ext_redis/hsetget.php.expect
hphp/test/slow/ext_redis/info.php.expect
hphp/test/slow/ext_redis/list.php.expect
hphp/test/slow/ext_redis/redis.inc
hphp/test/slow/ext_redis/setExtended.php.expect
hphp/test/slow/ext_redis/srandmember.php.expect
hphp/test/slow/ext_redis/watch.php
hphp/test/slow/ext_redis/watch.php.expect