mirror of
https://github.com/predis/predis.git
synced 2026-10-10 05:47:02 +00:00
Implement "crc16" client option for redis-cluster.
By default Predis chooses automatically which hash generator to use: if a suitable version of ext-phpiredis is loaded (that is, a version that implements the phpiredis_utils_crc16() function) it uses the new Predis\Cluster\Hash\PhpiredisCRC16 generator, otherwise it falls back to the usual pure-PHP Predis\Cluster\Hash\CRC16 generator.
This commit is contained in:
@@ -102,12 +102,19 @@ class ClusterTest extends PredisTestCase
|
||||
|
||||
$options = $this->getMock('Predis\Configuration\OptionsInterface');
|
||||
$options
|
||||
->expects($this->once())
|
||||
->expects($this->at(0))
|
||||
->method('__get')
|
||||
->with('connections')
|
||||
->will($this->returnValue(
|
||||
$this->getMock('Predis\Connection\FactoryInterface')
|
||||
));
|
||||
$options
|
||||
->expects($this->at(1))
|
||||
->method('__get')
|
||||
->with('crc16')
|
||||
->will($this->returnValue(
|
||||
$this->getMock('Predis\Cluster\Hash\HashGeneratorInterface')
|
||||
));
|
||||
|
||||
$this->assertInstanceOf('Closure', $initializer = $option->filter($options, 'redis'));
|
||||
$this->assertInstanceOf('Predis\Connection\Cluster\RedisCluster', $initializer($parameters = array()));
|
||||
|
||||
Reference in New Issue
Block a user