Пример #1
0
 public function testMeetWithCommandException()
 {
     $mock = $this->getMock('\\Phloppy\\Stream\\StreamInterface');
     $mock->expects($this->any())->method('write')->willReturn($mock);
     $mock->expects($this->at(6))->method('readLine')->willReturn('-ERR Invalid node address specified: c:12');
     $mock->expects($this->any())->method('readLine')->willReturn('+OK');
     $mock->expects($this->once())->method('getNodeUrl')->willReturn('a');
     $cluster = new Cluster($mock);
     $urls = ['tcp://a:1234', 'tcp://b:1234', 'https://c:12'];
     $result = $cluster->meet($urls);
     $this->assertEquals(array_slice($urls, 0, 2), $result);
 }
Пример #2
0
 public function testMeet()
 {
     $cluster = new Cluster($this->stream);
     $ok = $cluster->meet([$this->stream->getNodeUrl()]);
 }