public function testGetCluster() { $client = new Client(array('c1' => array(array('name' => 'local1', 'host' => 'localhost', 'port' => 11200))), 'MemcachedManager\\Tests\\Fixtures\\MockMemcached'); $node = new Node('localhost', 11200, 'local1'); $node->setAlive(1); $expected = new Cluster('c1'); $expected->addNode($node); $this->assertEquals($expected, $client->getCluster('c1')); }
public function testAddNode() { $cluster = new Cluster(); $this->assertEmpty($cluster->getNodes()); $cluster->addNode(new Node('localhost', 11211, 'testing')); $this->assertNotEmpty($cluster->getNodes()); $this->assertCount(1, $cluster->getNodes()); $nodes = $cluster->getNodes(); $this->assertEquals('localhost', $nodes[0]->getHost()); $this->assertEquals(11211, $nodes[0]->getPort()); $this->assertEquals('testing', $nodes[0]->getName()); }