public function testGetNodeNull() { $client = new Client(array('c1' => array(array('name' => 'local1', 'host' => 'localhost', 'port' => 11200), array('name' => 'local2', 'host' => 'localhost2', 'port' => 11201))), 'MemcachedManager\\Tests\\Fixtures\\MockMemcached'); $node2 = new Node('localhost2', 11201, 'local2'); $node2->setAlive(1); $this->assertFalse($client->getNode('c1', 'local3')); }
/** * Get a list of clusters * * @return array */ public function getClusters() { $populatedClusters = array(); if (!empty($this->clusters)) { foreach ($this->clusters as $clusterName => $servers) { //if this is the first node in the cluster, initialize the cluster if (!isset($populatedClusters[$clusterName])) { $populatedClusters[$clusterName] = new Cluster($clusterName); } foreach ($servers as $server) { $node = new Node($server['host'], $server['port'], isset($server['name']) ? $server['name'] : $server['host']); $node->setAlive($this->testConnection($node)); //add the node to the cluster $populatedClusters[$clusterName]->addNode($node); } } } return $populatedClusters; }
public function testSetAlive() { $node = new Node('localhost', 11211); $node->setAlive(true); $this->assertTrue($node->getAlive()); }