/**
  * @inheritdoc
  */
 protected function setUp()
 {
     parent::setUp();
     $this->mockSocket = m::mock('\\Hitmeister\\Component\\Metrics\\Socket\\Socket');
     $this->mockSocket->shouldReceive('close')->once();
     $this->mockSocket->shouldReceive('connectTimeout')->withArgs([$this->testHost . ':' . $this->testPort, $this->testTimeout])->once();
     $this->mockFactory = m::mock('\\Hitmeister\\Component\\Metrics\\Socket\\Factory');
     $this->mockFactory->shouldReceive('createUdp4')->andReturn($this->mockSocket);
 }
示例#2
0
 /**
  * @inheritdoc
  */
 protected function send($message)
 {
     $this->connect();
     $sent = $this->socket->write($message);
     return $sent == strlen($message);
 }