Path: blob/master/src/view/__tests__/PhabricatorLocalTimeTestCase.php
12249 views
<?php12final class PhabricatorLocalTimeTestCase extends PhabricatorTestCase {34protected function getPhabricatorTestCaseConfiguration() {5return array(6self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES => true,7);8}910public function testLocalTimeFormatting() {11$user = $this->generateNewTestUser();12$user->overrideTimezoneIdentifier('America/Los_Angeles');1314$utc = $this->generateNewTestUser();15$utc->overrideTimezoneIdentifier('UTC');1617$this->assertEqual(18'Jan 1 2000, 12:00 AM',19phabricator_datetime(946684800, $utc),20pht('Datetime formatting'));21$this->assertEqual(22'Jan 1 2000',23phabricator_date(946684800, $utc),24pht('Date formatting'));25$this->assertEqual(26'12:00 AM',27phabricator_time(946684800, $utc),28pht('Time formatting'));2930$this->assertEqual(31'Dec 31 1999, 4:00 PM',32phabricator_datetime(946684800, $user),33pht('Localization'));3435$this->assertEqual(36'',37phabricator_datetime(0, $user),38pht('Missing epoch should fail gracefully'));39}4041}424344