修正单元测试

This commit is contained in:
thinkphp
2016-07-08 17:24:59 +08:00
parent 077df8f1b9
commit 69ba372de0
2 changed files with 15 additions and 5 deletions

View File

@@ -17,11 +17,13 @@ class Memcached
{ {
protected $handler; protected $handler;
protected $options = [ protected $options = [
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'port' => 11211, 'port' => 11211,
'expire' => 0, 'expire' => 0,
'timeout' => 0, // 超时时间(单位:毫秒) 'timeout' => 0, // 超时时间(单位:毫秒)
'prefix' => '', 'prefix' => '',
'username' => '', //账号
'password' => '', //密码
]; ];
/** /**
@@ -54,6 +56,10 @@ class Memcached
$servers[] = [$host, (isset($ports[$i]) ? $ports[$i] : $ports[0]), 1]; $servers[] = [$host, (isset($ports[$i]) ? $ports[$i] : $ports[0]), 1];
} }
$this->handler->addServers($servers); $this->handler->addServers($servers);
if ('' != $this->options['username']) {
$this->handler->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
$this->handler->setSaslAuthData($this->options['username'], $this->options['password']);
}
} }
/** /**

View File

@@ -47,4 +47,8 @@ class memcachedTest extends cacheTestCase
public function testExpire() public function testExpire()
{ {
} }
public function testStaticCall()
{
}
} }