Exemplo n.º 1
0
 /**
  * Tests one message handle
  */
 public function testHandleOne()
 {
     $handler = new StatsDaemonHandler($this->testHost, $this->testPort, $this->testTimeout);
     $handler->setFactory($this->mockFactory);
     // Normal metric
     $metric1 = new CounterMetric('metric_name1', 10);
     $metric1->setSampleRate(0.5);
     $expectedMessage = self::$formatter->format($metric1);
     $this->mockSocket->shouldReceive('write')->withArgs([$expectedMessage])->once();
     $handler->handle($metric1);
     // Unsupported
     $metric2 = new DummyMetric('metric_name2', 20);
     $this->mockSocket->shouldNotReceive('write');
     $handler->handle($metric2);
 }
 /**
  * Tests unsupported formatter
  */
 public function testUnsupportedMetric()
 {
     $metric1 = new DummyMetric('metric_name1', 10);
     $this->assertFalse($this->formatter->format($metric1));
 }
Exemplo n.º 3
0
 /**
  * @iterations 1000
  */
 public function counterNameTagsAndSample()
 {
     $this->formatter->format($this->metricTagsSample);
 }