net_listening

This commit is contained in:
sc0Vu 2017-12-18 11:47:42 +08:00
parent 296d3442e0
commit b7ad62faaf
2 changed files with 22 additions and 0 deletions

View File

@ -31,6 +31,7 @@ class Net
private $methods = [
'net_version' => [],
'net_peerCount' => [],
'net_listening' => [],
];
/**

View File

@ -68,6 +68,27 @@ class NetTest extends TestCase
});
}
/**
* testListening
*
* @return void
*/
public function testListening()
{
$net = $this->net;
$net->listening(function ($err, $net) {
if ($err !== null) {
return $this->fail($err->getMessage());
}
if (isset($net->result)) {
$this->assertTrue(is_bool($net->result));
} else {
$this->fail($net->error->message);
}
});
}
/**
* testUnallowedMethod
*