Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo 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);
 }
Ejemplo n.º 3
0
 /**
  * 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));
 }