/** * @group disconnected */ public function testCanAssignConnectionsToCustomSlotsFromParameters() { $connection1 = $this->getMockConnection('tcp://127.0.0.1:6379?slots=0-5460'); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380?slots=5461-10921'); $connection3 = $this->getMockConnection('tcp://127.0.0.1:6381?slots=10922-16383'); $cluster = new RedisCluster(); $cluster->add($connection1); $cluster->add($connection2); $cluster->add($connection3); $expectedMap = array_merge(array_fill(0, 5461, '127.0.0.1:6379'), array_fill(5460, 5461, '127.0.0.1:6380'), array_fill(10921, 5462, '127.0.0.1:6381')); $cluster->buildSlotsMap(); $this->assertSame($expectedMap, $cluster->getSlotsMap()); }
/** * @group disconnected */ public function testCanAssignConnectionsToCustomSlotsFromParameters() { $connection1 = $this->getMockConnection('tcp://127.0.0.1:6379?slots=0-1364'); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380?slots=1365-2729'); $connection3 = $this->getMockConnection('tcp://127.0.0.1:6381?slots=2730-4095'); $cluster = new RedisCluster(); $cluster->add($connection1); $cluster->add($connection2); $cluster->add($connection3); $expectedMap = array_merge(array_fill(0, 1365, '127.0.0.1:6379'), array_fill(1364, 1365, '127.0.0.1:6380'), array_fill(2729, 1366, '127.0.0.1:6381')); $cluster->buildSlotsMap(); $this->assertSame($expectedMap, $cluster->getSlotsMap()); }