diff --git a/core/lib/Drupal/Component/Datetime/DateTimePlus.php b/core/lib/Drupal/Component/Datetime/DateTimePlus.php index 289d6c0..bd4f0df 100644 --- a/core/lib/Drupal/Component/Datetime/DateTimePlus.php +++ b/core/lib/Drupal/Component/Datetime/DateTimePlus.php @@ -47,44 +47,44 @@ class DateTimePlus extends \DateTime { /** * An array of possible date parts. */ - public static $date_parts = array( - 'year', - 'month', - 'day', - 'hour', - 'minute', - 'second', - ); + public static $dateParts = array( + 'year', + 'month', + 'day', + 'hour', + 'minute', + 'second', + ); /** * The value of the time value passed to the constructor. */ - public $input_time_raw = ''; + public $inputTimeRaw = ''; /** * The prepared time, without timezone, for this date. */ - public $input_time_adjusted = ''; + public $inputTimeAdjusted = ''; /** * The value of the timezone passed to the constructor. */ - public $input_timezone_raw = ''; + public $inputTimeZoneRaw = ''; /** * The prepared timezone object used to construct this date. */ - public $input_timezone_adjusted = ''; + public $inputTimeZoneAdjusted = ''; /** * The value of the format passed to the constructor. */ - public $input_format_raw = ''; + public $inputFormatRaw = ''; /** * The prepared format, if provided. */ - public $input_format_adjusted = ''; + public $inputFormatAdjusted = ''; /** * The value of the language code passed to the constructor. @@ -144,10 +144,6 @@ class DateTimePlus extends \DateTime { * - boolean $debug * Leave evidence of the input values in the resulting object * for debugging purposes. Defaults to FALSE. - * - * @TODO - * Potentially there will be additional ways to take advantage - * of calendar in date handling in the future. */ public function __construct($time = 'now', $timezone = NULL, $format = NULL, $settings = array()) { @@ -452,7 +448,6 @@ public function constructFallback() { } } catch (\Exception $e) { - dsm('HERE'); $this->errors[] = $e->getMessage(); } } @@ -505,27 +500,27 @@ function hasErrors() { */ public static function arrayToISO($array, $force_valid_date = FALSE) { $array = static::prepareArray($array, $force_valid_date); - $input_time_adjusted = ''; + $input_time = ''; if ($array['year'] !== '') { - $input_time_adjusted = static::datePad(intval($array['year']), 4); + $input_time = static::datePad(intval($array['year']), 4); if ($force_valid_date || $array['month'] !== '') { - $input_time_adjusted .= '-' . static::datePad(intval($array['month'])); + $input_time .= '-' . static::datePad(intval($array['month'])); if ($force_valid_date || $array['day'] !== '') { - $input_time_adjusted .= '-' . static::datePad(intval($array['day'])); + $input_time .= '-' . static::datePad(intval($array['day'])); } } } if ($array['hour'] !== '') { - $input_time_adjusted .= $input_time_adjusted ? 'T' : ''; - $input_time_adjusted .= static::datePad(intval($array['hour'])); + $input_time .= $input_time ? 'T' : ''; + $input_time .= static::datePad(intval($array['hour'])); if ($force_valid_date || $array['minute'] !== '') { - $input_time_adjusted .= ':' . static::datePad(intval($array['minute'])); + $input_time .= ':' . static::datePad(intval($array['minute'])); if ($force_valid_date || $array['second'] !== '') { - $input_time_adjusted .= ':' . static::datePad(intval($array['second'])); + $input_time .= ':' . static::datePad(intval($array['second'])); } } } - return $input_time_adjusted; + return $input_time; } /** @@ -680,10 +675,6 @@ function canUseIntl() { * * @return string * The formatted value of the date. - * - * @TODO - * Potentially there will be additional ways to take advantage - * of calendar in date handling in the future. */ function format($format, $settings = array()) { diff --git a/core/modules/system/lib/Drupal/system/Tests/Datetime/DateTimePlusTest.php b/core/modules/system/lib/Drupal/system/Tests/Datetime/DateTimePlusTest.php index a76e988..2f08c8d 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Datetime/DateTimePlusTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Datetime/DateTimePlusTest.php @@ -7,11 +7,11 @@ namespace Drupal\system\Tests\Datetime; -use Drupal\simpletest\WebTestBase; +use Drupal\simpletest\UnitTestBase; use Drupal\Component\Datetime\DateTimePlus; use DateTimeZone; -class DateTimePlusTest extends WebTestBase { +class DateTimePlusTest extends UnitTestBase { /** * Test information. @@ -30,14 +30,6 @@ public static function getInfo() { public static $modules = array(); /** - * Test setup. - */ - public function setUp() { - parent::setUp(); - variable_set('date_first_day', 1); - } - - /** * Test creating dates from string input. */ public function testDateStrings() { @@ -129,7 +121,6 @@ function testDateArrays() { $expected = '2010-02-28T10:00:00+01:00'; $this->assertEqual($expected, $value, "Test new DateTimePlus(array('year' => 2010, 'month' => 2, 'day' => 28, 'hour' => 10), $timezone): should be $expected, found $value."); - } /** @@ -276,7 +267,6 @@ function testTimezoneConversion() { $value = $date->getOffset(); $this->assertEqual($expected, $value, "The current offset should be $expected, found $value."); - } /** @@ -425,12 +415,4 @@ public function testDateTimezone() { $this->assertTrue($timezone == 'Pacific/Midway', 'DateTimePlus uses the specified timezone if provided.'); } - - /** - * Tear down after tests. - */ - public function tearDown() { - variable_del('date_first_day'); - parent::tearDown(); - } }