public function DateNowUnitTestCase::testDateNowStringTimezones in Date 7.3
Same name and namespace in other branches
- 7.2 tests/DateNowUnitTestCase.test \DateNowUnitTestCase::testDateNowStringTimezones()
Test with a string timezone.
File
- tests/
DateNowUnitTestCase.test, line 43 - Test Date Now unit tests.
Class
- DateNowUnitTestCase
- Test Date Now unit tests.
Code
public function testDateNowStringTimezones() {
$la_time = date_now('America/Los_Angeles');
$ny_time = date_now('America/New_York');
$this
->assertTrue($la_time instanceof DateObject, 'Test America/Los_Angeles returns a DateObject');
$this
->assertTrue($ny_time instanceof DateObject, 'Test America/New_York returns a DateObject');
$this
->assertEqual($la_time
->getTimestamp(), $ny_time
->getTimestamp(), 'Test different timezones have same Unix timestamp');
}