/**
  * Set the timestamp as float.
  *
  * @param float $timestamp The timestamp as float.
  */
 public function setMicrotimeAsFloat($timestamp)
 {
     if (!is_numeric($timestamp)) {
         throw new \InvalidArgumentException("Timestamp should be numeric");
     }
     $converter = new MicrotimeConverter();
     $this->timestamp = $converter->convertFloatToString($timestamp);
 }
Esempio n. 2
0
 /**
  * Set the timestamp as float.
  *
  * @param float $timestamp The timestamp as float.
  */
 public function setMicrotimeAsFloat($timestamp)
 {
     $converter = new MicrotimeConverter();
     $this->timestamp = $converter->convertFloatToString($timestamp);
 }
 /**
  * Test convertFloatToString().
  *
  * @param float  $float   The timestamp.
  * @param string $string  The timestamp.
  *
  * @test
  * @dataProvider provideFloatAndStrings
  */
 public function testConvertFloatToString($float, $string)
 {
     $converter = new MicrotimeConverter();
     $this->assertEquals($string, $converter->convertFloatToString($float));
 }