public function testOptionsAddServer() { $options = new Cache\Storage\Adapter\MemcachedOptions(); $options->addServer('127.0.0.1', 11211); $options->addServer('localhost'); $options->addServer('domain.com', 11215); $servers = array(array('127.0.0.1', 11211), array('localhost', 11211), array('domain.com', 11215)); $this->assertEquals($options->getServers(), $servers); $memcached = new Cache\Storage\Adapter\Memcached($options); $this->assertEquals($memcached->getOptions()->getServers(), $servers); }
/** * @deprecated */ public function testOptionsAddServer() { $options = new Cache\Storage\Adapter\MemcachedOptions(); $deprecated = false; set_error_handler(function () use(&$deprecated) { $deprecated = true; }, E_USER_DEPRECATED); $options->addServer('127.0.0.1', 11211); $options->addServer('localhost'); $options->addServer('domain.com', 11215); restore_error_handler(); $this->assertTrue($deprecated, 'Missing deprecated error'); $servers = array(array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 0), array('host' => 'localhost', 'port' => 11211, 'weight' => 0), array('host' => 'domain.com', 'port' => 11215, 'weight' => 0)); $this->assertEquals($options->getServers(), $servers); $memcached = new Cache\Storage\Adapter\Memcached($options); $this->assertEquals($memcached->getOptions()->getServers(), $servers); }