/**
  * Test 'addServer', 'addServers', 'getServerList', 'getStats', 'getVersion', 'isPersistent' and 'isPristine' methods.
  */
 public function testServerMethods()
 {
     $mock = new MemcachedMock();
     $mock->setLogger(new MemcachedLogger(new TestLogger()));
     $servers = $mock->getServerList();
     $this->assertInternalType('array', $servers);
     $this->assertCount(0, $servers);
     $this->assertFalse($mock->getStats());
     $this->assertFalse($mock->getVersion());
     $this->assertFalse($mock->isPersistent());
     $this->assertFalse($mock->isPristine());
     $this->assertFalse($mock->addServers([1]));
     $this->assertFalse($mock->addServers([['a', 'b']]));
     $this->assertFalse($mock->addServers([['127.0.0.1', 123, 'a']]));
     $this->assertFalse($mock->addServers([['127.0.0.1', 123], ['127.0.0.1', 'a']]));
     $mock->setThrowExceptionsOnFailure(true);
     $this->assertTrue($mock->resetServerList());
     $servers = $mock->getServerList();
     $this->assertInternalType('array', $servers);
     $this->assertCount(0, $servers);
     $this->assertTrue($mock->addServer('127.0.0.1', 11211));
     $servers = $mock->getServerList();
     $this->assertCount(1, $servers);
     $this->assertSame('127.0.0.1', $servers[0]['host']);
     $this->assertSame(11211, $servers[0]['port']);
     $stats = $mock->getStats();
     $this->assertInternalType('array', $stats);
     /* @var array $stats */
     $this->assertCount(1, $stats);
     $this->assertArrayHasKey('127.0.0.1:11211', $stats);
     $this->assertArrayHasKey('version', $stats['127.0.0.1:11211']);
     $this->assertTrue($mock->addServers([['127.0.0.2', 11212], ['127.0.0.3', 11213, 3]]));
     $stats = $mock->getStats();
     $this->assertCount(3, $stats);
     $this->assertArrayHasKey('127.0.0.1:11211', $stats);
     $this->assertArrayHasKey('version', $stats['127.0.0.1:11211']);
     $this->assertInternalType('string', $stats['127.0.0.1:11211']['version']);
     $this->assertArrayHasKey('127.0.0.2:11212', $stats);
     $this->assertArrayHasKey('version', $stats['127.0.0.2:11212']);
     $this->assertInternalType('string', $stats['127.0.0.2:11212']['version']);
     $this->assertArrayHasKey('127.0.0.3:11213', $stats);
     $this->assertArrayHasKey('version', $stats['127.0.0.3:11213']);
     $this->assertInternalType('string', $stats['127.0.0.3:11213']['version']);
     $serverList = $mock->getServerList();
     $this->assertInternalType('array', $serverList);
     $this->assertCount(3, $serverList);
     $this->assertInternalType('array', $serverList[0]);
     $this->assertArrayHasKey('host', $serverList[0]);
     $this->assertSame('127.0.0.1', $serverList[0]['host']);
     $this->assertArrayHasKey('port', $serverList[0]);
     $this->assertSame(11211, $serverList[0]['port']);
     $this->assertInternalType('array', $serverList[1]);
     $this->assertArrayHasKey('host', $serverList[1]);
     $this->assertSame('127.0.0.2', $serverList[1]['host']);
     $this->assertArrayHasKey('port', $serverList[1]);
     $this->assertSame(11212, $serverList[1]['port']);
     $this->assertInternalType('array', $serverList[2]);
     $this->assertArrayHasKey('host', $serverList[2]);
     $this->assertSame('127.0.0.3', $serverList[2]['host']);
     $this->assertArrayHasKey('port', $serverList[2]);
     $this->assertSame(11213, $serverList[2]['port']);
     $version = $mock->getVersion();
     $this->assertInternalType('array', $version);
     /* @var array $version */
     $this->assertArrayHasKey('127.0.0.1:11211', $version);
     $this->assertSame('x.x.mock', $version['127.0.0.1:11211']);
     $this->assertArrayHasKey('127.0.0.2:11212', $version);
     $this->assertSame('x.x.mock', $version['127.0.0.2:11212']);
     $this->assertArrayHasKey('127.0.0.3:11213', $version);
     $this->assertSame('x.x.mock', $version['127.0.0.3:11213']);
     $this->assertTrue($mock->quit());
     $serverList = $mock->getServerList();
     $this->assertInternalType('array', $serverList);
     $this->assertCount(0, $serverList);
     $this->assertTrue($mock->addServer('127.0.0.1', 11211));
     $servers = $mock->getServerList();
     $this->assertCount(1, $servers);
     $this->assertTrue($mock->resetServerList());
     $this->assertInternalType('array', $serverList);
     $servers = $mock->getServerList();
     $this->assertCount(0, $servers);
     $mock->setThrowExceptionsOnFailure(false);
     $this->assertFalse($mock->getStats());
     $this->assertFalse($mock->addServer(null, null));
     $this->assertTrue($mock->addServers([]));
 }