public function DateTimePlusTest::testDateTimezone in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::testDateTimezone()
- 9 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::testDateTimezone()
Tests that DrupalDateTime can detect the right timezone to use.
When specified or not.
@dataProvider providerTestDateTimezone
Parameters
mixed $input: Input argument for DateTimePlus.
mixed $timezone: Timezone argument for DateTimePlus.
string $expected_timezone: Expected timezone returned from DateTimePlus::getTimezone::getName().
string $message: Message to print on test failure.
File
- core/
tests/ Drupal/ Tests/ Component/ Datetime/ DateTimePlusTest.php, line 287
Class
- DateTimePlusTest
- @coversDefaultClass \Drupal\Component\Datetime\DateTimePlus @group Datetime
Namespace
Drupal\Tests\Component\DatetimeCode
public function testDateTimezone($input, $timezone, $expected_timezone, $message) {
$date = new DateTimePlus($input, $timezone);
$timezone = $date
->getTimezone()
->getName();
$this
->assertEquals($timezone, $expected_timezone, $message);
}