phpmock\functions\FixedMicrotimeFunction::getMicrotime PHP Метод

getMicrotime() публичный Метод

Returns the microtime.
public getMicrotime ( boolean $get_as_float = false ) : mixed
$get_as_float boolean If true returns timestamp as float, else string
Результат mixed The value.
    public function getMicrotime($get_as_float = false)
    {
        if ($get_as_float) {
            $converter = new MicrotimeConverter();
            return $converter->convertStringToFloat($this->timestamp);
        } else {
            return $this->timestamp;
        }
    }

Usage Example

 /**
  * Tests initializing with a timestamp.
  *
  * @param mixed $timestamp The tested timestamp.
  * @param float $expected  The expected timestamp.
  *
  * @test
  * @dataProvider provideTestConstruct
  */
 public function testConstruct($timestamp, $expected)
 {
     $function = new FixedMicrotimeFunction($timestamp);
     $this->assertEquals($expected, $function->getMicrotime(true));
 }