Exemplo n.º 1
0
 public function it_stores_metrics(Stream $stream, FormatterInterface $formatter, SourceInterface $source, Metric $metric1, Metric $metric2)
 {
     $source->getMetrics()->willReturn([$metric1, $metric2])->shouldBeCalled();
     $formatter->format($metric1)->willReturn('metric_1_formatted')->shouldBeCalled();
     $formatter->format($metric2)->willReturn('metric_2_formatted')->shouldBeCalled();
     $stream->write('metric_1_formatted')->shouldBeCalled();
     $stream->write('metric_2_formatted')->shouldBeCalled();
     $this->store($source);
 }
Exemplo n.º 2
0
 /**
  * @param SourceInterface $source
  */
 public function store(SourceInterface $source)
 {
     foreach ($source->getMetrics() as $metric) {
         $this->stream->write($this->formatter->format($metric));
     }
 }