/** * Method flush must to reset value of field `data`. */ public function testFlushWhenCallsTwiceWithDifferentData() { $firstExpectedVariableValue = 123; $secondExpectedVariableValue = 321; $gaugeMock = $this->getMockBuilder('\\Prometheus\\Gauge')->disableOriginalConstructor()->getMock(); $gaugeMock->expects($this->at(0))->method('set')->with($firstExpectedVariableValue, array()); $gaugeMock->expects($this->at(1))->method('set')->with($secondExpectedVariableValue, array()); $this->collectorRegistryMock->expects($this->exactly(2))->method('getGauge')->with(self::TEST_NAMESPACE, self::TEST_VARIABLE_NAME)->willReturn($gaugeMock); $this->collector->measure(self::TEST_VARIABLE_NAME, $firstExpectedVariableValue); $this->collector->flush(); $this->collector->measure(self::TEST_VARIABLE_NAME, $secondExpectedVariableValue); $this->collector->flush(); }