public function TimeTest::testGetRequestTime in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Component/Datetime/TimeTest.php \Drupal\Tests\Component\Datetime\TimeTest::testGetRequestTime()
Tests the getRequestTime method.
@covers ::getRequestTime
File
- core/
tests/ Drupal/ Tests/ Component/ Datetime/ TimeTest.php, line 49
Class
- TimeTest
- @coversDefaultClass \Drupal\Component\Datetime\Time @group Datetime
Namespace
Drupal\Tests\Component\DatetimeCode
public function testGetRequestTime() {
$expected = 12345678;
$request = Request::createFromGlobals();
$request->server
->set('REQUEST_TIME', $expected);
// Mocks a the request stack getting the current request.
$this->requestStack
->expects($this
->any())
->method('getCurrentRequest')
->willReturn($request);
$this
->assertEquals($expected, $this->time
->getRequestTime());
}