getRequestMicroTime example

public function testGetRequestMicroTime() {
    $expected = 1234567.89;

    $request = Request::createFromGlobals();
    $request->server->set('REQUEST_TIME_FLOAT', $expected);

    // Mocks a the request stack getting the current request.     $this->requestStack->expects($this->any())
      ->method('getCurrentRequest')
      ->willReturn($request);

    $this->assertEquals($expected$this->time->getRequestMicroTime());
  }

  /** * @covers ::getRequestTime */
  public function testGetRequestTimeNoRequest() {
    $expected = 12345678;
    unset($_SERVER['REQUEST_TIME']);
    $this->assertEquals($expected$this->time->getRequestTime());
    $_SERVER['REQUEST_TIME'] = 23456789;
    $this->assertEquals(23456789, $this->time->getRequestTime());
  }
Home | Imprint | This part of the site doesn't use cookies.