示例#1
0
 public function testConstruct_withArgs_createsSocketWithArgs()
 {
     $this->_socketCreateSuccess();
     $hostName = 'testHostName';
     $port = 666;
     $socket = new Socket($hostName, $port);
     $this->assertEquals($hostName, $socket->getHostname());
     $this->assertEquals($port, $socket->getPort());
     $this->assertFalse($socket->isConnected());
     $this->assertNotNull($socket->getRaw());
 }
示例#2
0
 /**
  * @param Socket $socket
  *
  * @return bool
  */
 public function equals(Socket $socket) : bool
 {
     if (!$socket instanceof $this) {
         return FALSE;
     }
     if ($this->getHost() != $socket->getHost()) {
         return FALSE;
     }
     if ($this->getPort() != $socket->getPort()) {
         return FALSE;
     }
     return TRUE;
 }