public function BrowserTestBaseTest::testLocalTimeZone in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest::testLocalTimeZone()
- 9 core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest::testLocalTimeZone()
Tests the assumption that local time is in 'Australia/Sydney'.
File
- core/
tests/ Drupal/ FunctionalTests/ BrowserTestBaseTest.php, line 566
Class
- BrowserTestBaseTest
- Tests BrowserTestBase functionality.
Namespace
Drupal\FunctionalTestsCode
public function testLocalTimeZone() {
$expected = 'Australia/Sydney';
// The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php
$this
->assertEquals($expected, date_default_timezone_get());
// The 'Australia/Sydney' time zone is also set in
// FunctionalTestSetupTrait::initConfig().
$config_factory = $this->container
->get('config.factory');
$value = $config_factory
->get('system.date')
->get('timezone.default');
$this
->assertEquals($expected, $value);
// Test that users have the correct time zone set.
$this
->assertEquals($expected, $this->rootUser
->getTimeZone());
$admin_user = $this
->drupalCreateUser([
'administer site configuration',
]);
$this
->assertEquals($expected, $admin_user
->getTimeZone());
}