本文整理汇总了PHP中Client::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::run方法的具体用法?PHP Client::run怎么用?PHP Client::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client::run方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRunMaxSeconds
public function testRunMaxSeconds()
{
$client = new Client();
$client->connect();
$s = microtime(true);
$client->run(1.0);
$e = microtime(true);
$this->assertLessThan(2.0, $e - $s);
}
示例2: run
/**
* @return array
*/
public function run()
{
$this->results = [];
foreach ($this->tests as $test) {
$resultId = $this->client->run($test->test_id);
$this->output($test->name . ' ');
for ($i = 0; $i <= 20; $i++) {
$result = $this->client->result($test->test_id, $resultId);
if ($result->status === 'ready') {
$this->results[] = $result;
break;
}
$this->output('.');
sleep(10);
}
$this->output(PHP_EOL);
}
return $this->results;
}
示例3: testClose
public function testClose()
{
$c = new Client();
$c->connect();
$promise = $c->channel()->close();
$this->assertInstanceOf("React\\Promise\\PromiseInterface", $promise);
$promise->then(function () use($c) {
$c->stop();
});
$c->run();
}
示例4: testRun
public function testRun()
{
$client = new Client('test');
$this->setExpectedException('Puppy\\Route\\RouteException', 'No route found for uri "/"');
$client->run('/');
}
示例5: addLog
* @param str $log 日志内容
* @return
*/
protected function addLog($log)
{
$log = date("Y-m-d H:i:s") . " {$log} \n";
file_put_contents($this->logFilePath, $log, FILE_APPEND | LOCK_EX);
echo date("Y-m-d H:i:s") . " {$log} \n";
}
protected function get_files_by_ext($path, $ext)
{
$files = array();
if (is_dir($path)) {
$handle = opendir($path);
while ($file = readdir($handle)) {
if ($file[0] == '.') {
continue;
}
if (is_file($path . $file) && preg_match('/\\.' . $ext . '$/', $file)) {
$files[] = $file;
}
}
closedir($handle);
sort($files);
}
return $files;
}
}
$obj = new Client();
$obj->run();
示例6: bindec
$payloadLengthBin = str_split(sprintf('%016b', $payloadLength), 8);
$frameHead[1] = $masked === true ? 254 : 126;
$frameHead[2] = bindec($payloadLengthBin[0]);
$frameHead[3] = bindec($payloadLengthBin[1]);
} else {
$frameHead[1] = $masked === true ? $payloadLength + 128 : $payloadLength;
}
// convert frame-head to string:
foreach (array_keys($frameHead) as $i) {
$frameHead[$i] = chr($frameHead[$i]);
}
if ($masked === true) {
// generate a random mask:
$mask = array();
for ($i = 0; $i < 4; $i++) {
$mask[$i] = chr(rand(0, 255));
}
$frameHead = array_merge($frameHead, $mask);
}
$frame = implode('', $frameHead);
// append payload to frame:
for ($i = 0; $i < $payloadLength; $i++) {
$frame .= $masked === true ? $payload[$i] ^ $mask[$i % 4] : $payload[$i];
}
return $frame;
}
}
$settings = array('host' => '0.0.0.0', 'port' => 10001, 'local' => 'http://liamka.me');
$Client = new Client($settings);
$Client->run();
示例7: testRun
public function testRun()
{
$client = new Client();
$res = $client->run();
$this->assertTrue($res);
}